How to get max value in a column

  • 25 January 2018
  • 3 replies
  • 33 views

Badge +10

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


3 replies

Userlevel 5
Badge +14

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.

Badge +10

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)

Userlevel 5
Badge +14

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

213044_pastedImage_1.png

Reply