dynamic dropdown with month by date

How to create a dynamic dropdown for months from a date column.

Overview

The issue arises because the database stores full dates, but the dropdown needs to display and filter by month names.
Add a separate column to store the month name, or use a custom query or PHP code to extract the month from the date field for the dropdown.

Answered
ad admin_wiky 22 Oct, 2014
Hi all

I have one table with some columns. One column is Date (YYYY-MM-DD) and other are some numeric values.
I need to show data for certain month ie: january, but I save to table date in form 2014-12-31 and I dont know how use it in dropdown.

any idea?
Thx
Gr GreyHead 22 Oct, 2014
Hi homeopat,

This looks like the same question as you have in another thread?

Bob
ad admin_wiky 23 Oct, 2014
Ho Bob,

similar, not same .... that was general about dynamic dropdown.
Gr GreyHead 23 Oct, 2014
Answer
Hi homeopat,

I have the same answer - if you're planning to use the month then the simplest solution is to save that column to the database as well as the date.

Otherwise you can use a Custom Code action either:

a. to build a custom MySQL query that that will extract the month from the date and GROUP BY the result; or

b. Use PHP in a Custom Code action to process the results from the CF DB Read/Load action and extract the data you need for the dynamic drop-down.

Any of these will work, which is best depends on your forms and data setup.

Bob
ad admin_wiky 23 Oct, 2014
Hi Bob,
I am no sure if I understand u.
U mean add one column where name of month will be saved?
This topic is locked and no more replies can be posted.