Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
scheibercamo
Contributor III
Contributor III

How do you sort names within a field into order for a chart?

I have 13,000 items that belong to one of the following age bands. I want them to appear in a bar chart (measuring some other value) but in the following order:

Age Band

Past due > 360 days
Past due 181 - 360 days
Past due 91 - 180 days
Past due 61 - 90 days
Past due 31 - 60 days
Past due 1 - 30 days
Due 0 - 30 days
Due 31 - 60 days
Due 61 - 90 days
Due > 90 days

When I tried:

match([Age Band]),'Past due>360 days','Past due - 360 days','Past due 91 -180 days','Past due 61 -90 days','Past due 31 - 60 days','Past due 1 - 30 days','Due 0 - 30 days','Due 31 - 60 days','Due 61 -90 days','Due>90 days')

It didn't work. Thanks for your help in advance.

1 Solution

Accepted Solutions
shivkumar300
Contributor III
Contributor III

Hi,

use this code in sort by expression

=if([Age Band]='Past due > 360 days','1',  if([Age Band]='Past due 181 - 360 days','2',  if([Age Band]='Past due 91 - 180 days','3',  if([Age Band]='Past due 61 - 90 days','4',  if([Age Band]='Past due 31 - 60 days','5',  if([Age Band]='Past due 1 - 30 days','6',  if([Age Band]='Due 0 - 30 days','7',  if([Age Band]='Due 31 - 60 days','8',  if([Age Band]='Due 61 - 90 days','9',10  )))))))))

in other way you can do it by creating a new field in your script

=if([Age Band]='Past due > 360 days','1',  if([Age Band]='Past due 181 - 360 days','2',  if([Age Band]='Past due 91 - 180 days','3',  if([Age Band]='Past due 61 - 90 days','4',  if([Age Band]='Past due 31 - 60 days','5',  if([Age Band]='Past due 1 - 30 days','6',  if([Age Band]='Due 0 - 30 days','7',  if([Age Band]='Due 31 - 60 days','8',  if([Age Band]='Due 61 - 90 days','9',10  ))))))))) as Sort

then do sorting according to sort field in sort by expression 

View solution in original post

8 Replies
sunny_talwar

Are you creating these bands in the script? If you are, then create them using Dual function so that you can provide them a sorting value

scheibercamo
Contributor III
Contributor III
Author

Hey Sunny! No, I added them later under sorting as an expression for that value.

How do I create them using dual function?

sunny_talwar

Can you share your current expression?

scheibercamo
Contributor III
Contributor III
Author

match([Age Band],'Past due > 360 days','Past due 181 - 360 days','Past due 91 - 180 days','Past due 61 - 90 days','Past due 31 - 60 days','Past due 1 - 30 days','Due 0 - 30 days','Due 31 - 60 days','Due 61 - 90 days','Due > 90 days')

I actually tried it again and it seemed to work, but only when I start typing "Age Band" and I select it from the drop-down.

Even though my issue is solved I'd like to know what that is.

Not applicable

jaimeaguilar
Partner - Specialist II
Partner - Specialist II

HI,

maybe if you try with pick(match)), something like this:

pick(match([Age Band],'Past due > 360 days','Past due 181 - 360 days'), 1, 2) and so on...

regards

shivkumar300
Contributor III
Contributor III

Hi,

use this code in sort by expression

=if([Age Band]='Past due > 360 days','1',  if([Age Band]='Past due 181 - 360 days','2',  if([Age Band]='Past due 91 - 180 days','3',  if([Age Band]='Past due 61 - 90 days','4',  if([Age Band]='Past due 31 - 60 days','5',  if([Age Band]='Past due 1 - 30 days','6',  if([Age Band]='Due 0 - 30 days','7',  if([Age Band]='Due 31 - 60 days','8',  if([Age Band]='Due 61 - 90 days','9',10  )))))))))

in other way you can do it by creating a new field in your script

=if([Age Band]='Past due > 360 days','1',  if([Age Band]='Past due 181 - 360 days','2',  if([Age Band]='Past due 91 - 180 days','3',  if([Age Band]='Past due 61 - 90 days','4',  if([Age Band]='Past due 31 - 60 days','5',  if([Age Band]='Past due 1 - 30 days','6',  if([Age Band]='Due 0 - 30 days','7',  if([Age Band]='Due 31 - 60 days','8',  if([Age Band]='Due 61 - 90 days','9',10  ))))))))) as Sort

then do sorting according to sort field in sort by expression 

sunny_talwar

May be because of extra spaces between Age and Band... Difficult to say much without seeing your app...