cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

How to get max value in a column

I am trying query list in workflow, to get the record having the maximum value , the field is a single line text field.

The normal descending and ascending is not working. Getting the below sequence. Tried the collection sort also., didn't work

18007;

18007;

180060;

18006;

18006;

180059;

18005;

18005

Is there a way to sort it like

180060

180059

18007

... etc

Labels: (2)
Tags (2)
0 Kudos
Reply
3 Replies
Workflow Hero

Re: How to get max value in a column

since the list field is of type text they are sorted as strings not as numbers.

if you are sure the field can contain just numbers can you change its type to numeric?

if not, as a workaround you could create a calculated list field being equal to this text field but having numeric type. then make query/sort/filter by this calculated field.

Accept as Solution Reply
Workflow Hero

Re: How to get max value in a column

Thanks Marian,

I can't change the data type to numeric due to some reason.

I tried creating the calculated field with numeric type and even that did not work.

Finally end up with looping through the collection to find the greatest number (well the idea was to get the greatest number)

Accept as Solution Reply
Workflow Hero

Re: How to get max value in a column

I tried creating the calculated field with numeric type and even that did not work.

can you try with a fake formula like

= textColumn * 1

for me it sorts correctly

0 Kudos
Accept as Solution Reply