Skip to main content

Hi All,
I have created one column Month_Year in one of my tables which I am using for creating the analysis dashboard. The Month_Year column is of type Varchar and so when I am creating a drop-down component in the analysis rather than getting the Month_Year column in date order I am getting it in alphabetical order. Sure I know there would be answers to this query saying to change the datatype to date and then do the to_date function in the front end but in that scenario, I am getting unwanted things like day, time, hour, seconds and all. I only want the month and year to be displayed in the dropdown and that to in date order. Can anyone please help me on this query

Sounds like you know already your answer ;)
You will never be able to sort it in date order if it is a varchar in the backend table.

So I believe there is no need to add that column all together but just stick with the original datetime column.

What you might not be aware of is the custom formatting you can do on a date field in the frontend.

and not necessarily but perhaps you want to bring all of them together to the exact same value wrapping your time column into a PQL ROUND_MOUNTH(<place your time column here>).

For the sake of completeness: If you want to stick with varchar in backend you can use TO_DATE PQL to convert it into a Datetime in frontend and then do the formatting as describd above. However I do not see any benefit of the varchar column justifying having that added workarounds and complexity.
 


Hi Manuel.wetze,

Thanks for the help!


Reply