Forum

This content is now out of date.

Visit Our Community

How to sort Alphanumeric values.

Hi,

I have this report where i have a list of values starting from number -1..2..3 and so on till 36.

When i pull data in report - column is not sorted correctly - 1..10..11..12.....2..20..21..
see the screen shot.

Forum image


How can i pull data in correct order ??
1..2..3..4.. and so on.

Thanks,
Mansi Sharma.
Hi Mansi,

Here's how I would go about getting your data in the correct order. In the report builder, click the little triangle button on the field header and mouse over the 'Sort' section. From here, you can select either an ascending or descending sort. (It sounds like you need an ascending sort) It should look something like this:


Forum image


Hopefully this gets you where you need to go. Please let me know if this doesn't work for you, or if you have any further questions.


Thanks!

-Conner
Hi Conner,

Thanks for replying.

Ascending Sort is not working as i have already tried. Reason is the data type of column i am using is not Numeric, its a string type (I have tried - NVARCHAR,CHAR,VARCHAR).
See the screen shot -

Forum image



Forum image


Data type on view level :


Forum image


My question is - I want to sort this column in order 1.UPID,2.LastName,3.FirstName,4.... and so on.

Please guide me what best way i can do this.

Thanks,
Mansi Sharma.
Mansi,

Apologies for the delayed response.

Ah, I didn't know that these were all text fields. That explains the wonky sort. Because of the field being a text-based, it won't do an expected numeric sort. So, what we're seeing in your screenshots is expected behavior.

Fixing this sounds like a job for Org Ref Codes, which allow you to set custom sorts for specific fields within Yellowfin. Here's a link to our wiki that explains how to set these up:
http://wiki.yellowfin.com.au/display/USER72/Org+Reference+Codes?src=search

Other than Ref Codes, the other thing that I can suggest is to restructure your data on the back end if you anticipate doing lots of sorts like this in the future. Mixing leading ints and text is generally not considered to be a best practice, one of the reasons being what you're experiencing.

Hopefully this clears things up and gets you set up properly!


Thanks,

-Conner

Hi Conner,

IMHO, alphanumeric is commonly used. For example, in transit, our clients name their routes in various ways. For example
R1
R2
R3
R11
R12A
R12B
R20
R30

With a simple string sort, it will look like.
R1
R11
R12A
R12B
R2
R20
R3
R30

Is it possible for YF to implement alphanumeric sort? Is it possible for us to add custom sorting?