85
Views
9
Comments
fetch Minimum date from list
Question

Hi ,

I have list of certain records so need to fetch minimum date value from that records.

2020-11-25 10-45-32
Mostafa Othman
Champion

Hello Vivek,

If its a list sort it using creation date ascending and fetch first record of sorted list. You have action listSort and give it sort attribute and direction then fetch ListSort.List.current

UserImage.jpg
Vivek Pandurang Pandile

I have one column in records so what I did use Listsort. In Listsort passing filtered list then in By passing column name then ascending is true and after that I will get minimum date for current Listsort output rt? But I cant see Listsort while assigning

2020-11-25 10-45-32
Mostafa Othman
Champion

Thats correct but I don't understand what you mean by can't see listsort.

If you can't find action itself just write into search ListSort, if you couldn't see action click Search in other modules then add this action as dependancy

2020-11-25 10-45-32
Mostafa Othman
Champion

Sorry, in assignment you will make yourVariable = yourListName.Current or

yourVariable = yourListName[0]

2022-07-11 07-49-33
Alka Asnani

Hi Vivek

To achieve this you can -

1.Create a server action that takes the list of records as input.

2.Inside the server action, use the List Sort action to sort the input list based on the date attribute ( "Ascending" sort direction).

3.After sorting the list, the minimum date value will be at the first position (index 1) in the sorted list. Assign this minimum date value to a local variable or return it as the result of the server action, based on how you want to use the result.

Hope this helps

Thanks

2020-11-25 10-45-32
Mostafa Othman
Champion

Hi Alka,

Just a quick update to your answer, the first position will be index 0 not 1

2022-07-11 07-49-33
Alka Asnani

Ya in list the indexing starts from 0. 

Thanks for the update.

2023-05-08 05-34-05
Piyali Saha

Hi @Vivek Pandurang Pandile 

Below are the pseudo steps to achieve your requirement:

1. Go to manage dependency and from system select list sort according to your requirement select client side or server side list sort method and apply.

2. Then call the list sort in the action flow.

3. Set the list and assign the attribute in By property to sort by date attribute and then set the direction of sorting as ASC.

Finally, store the value from the list at 0 index as minimum date value.

Hope this helps you.

Thanks & Regards.


2025-02-13 09-42-38
Helga Afonso

Hello! Can you please explain this last step " store the value from the list at 0 index as minimum date value. "?


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.