Custom Display Text in ComboBox

  

Hi all, I have a combobox on a web page, which I am populatinhg from an aggregate. The aggregate contains a Version column which is a calculated column:

It is calculated as follows:

"Version " + PrivacyPolicy.Id + " - " + PrivacyPolicy.PublishDate

In the combobox, the dropdown can use the Version column as a Source Attribute to give the following:

Is there a way to format the date and time displayed in this dropdown? If I try to alter my code snippet in the aggregate to include FormatDateTime it gives me an error in the expression editor that the function is not available in the database.

Solution

Hi Russel,

Suggestion is to use the Year(yourDate) +"/" + Month(yourDate) etc.. in your custom attribute

Did not check if there are better/other suggestions.


J.


Solution

Hi Russel,
Indeed not all Build-In-Functions are allowed to use in aggregates/SQL statements. So for you case I think the best solutions is to use a Local variable as Source Record for this Combo Box. 

In the preparation you can fetch the version and the data in one aggregate and after that use the ListAppendAll Function to add the result of the Aggregate to the Local variable. In this action you could you can set the format of the Version attribute Including the Policy.Id

It's not ideal but it's an solution.

Kind regards,
Martijn Habraken


EDIT: I think J's solution maybe is better for your maintainability. 

Thanks both for the replies, I have tried both ways now, and I think that yes J's solution is probably easier to maintain, and keeps all the formatting local to the aggregate as well. Thanks for taking a look at it so quickly.

Having investigated this further, if basic formatting is needed then handling it in the aggregate is best, but if any extra formatting is needed, such as listing the actual day of the week, then this would still need to be handled in a  local variable.