How to sort strings that contain dates in a reference variable?

Smith Johnson
Tera Guru

Hello,

I have a variable "Period" in a catalog item which is a reference variable, and displays the following values.

SmithJohnson_1-1752048894181.png

 

However, considering that these values contain dates, I would like them to be sorted based on their start date in an ascending order. So it should look like this: 10/07/2025 - 24/07/2025, 31/07/2025 - 07/08/2025, 08/09/2025 - 10/09/2025. 

Even if I have an advanced ref qualifier calling a script include which sorts the values based on the start date, in the catalog item it is still sorted alphabetically (refer to the img above). 

How can I disable the alphabetical sorting? Or any other ideas?

Thank you,
Smith.

7 REPLIES 7

PratikshaKate
Tera Contributor

@Smith Johnson Did you try giving order by clause in the reference qualifier field? can you share your script here

Hello, thank you for your reply. 
The thing is that even if i have a simple script like this with hardcoded sys_ids (for testing purposes), again it doesn't work. For example, if I have something like this in my script: returns "sys_idIN<sys_id1>,<sys_id2>,<sys_id3>"

I would expect first to show the record with sys_id1, then the record with sys_id2, and then with sys_id3. However, it doesn't work. It still shows the records alphabetically sorted.


Community Alums
Not applicable

Hi @Smith Johnson 
Please use the following variable attribute: ref_ac_order_by=(start_date) to sort the result in ascending order.

 

Please let me know if you need anything else.

Please mark the answer as correct/helpful if it helps.

 

Thanks,

Brahmjeet

Hello, thanks for your reply. However, I don't have a start_date column. If I had, indeed this would be the solution.