Case-insensitive sorting or custom function for sort

Stimulsoft Reports.Flex discussion
jakrzysztow
Posts: 18
Joined: Tue Aug 09, 2011 10:35 am

Case-insensitive sorting or custom function for sort

Post by jakrzysztow »

Is there anyway to have the sorting be case-insensitive?

Is there anyway to have specify a function for sorting?

Currently, I am trigger sorting by the StiDataBand sort property.

At one point I thought there was a way to sort the data rows directly and then have the report just display in the current order, but I cannot locate that information any longer.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Case-insensitive sorting or custom function for sort

Post by Vladimir »

Hello,

You can use the following expression in the sort condition:

Code: Select all

ToLowerCase(ColumnName)
Thank you.
jakrzysztow
Posts: 18
Joined: Tue Aug 09, 2011 10:35 am

Re: Case-insensitive sorting or custom function for sort

Post by jakrzysztow »

I do not understand...

In AS3, I have the following code.

band.sort = [ "ASC", "LastName", "ASC", "FirstName" ];

If I change "ASC" to ToLowerCase("LastName") the code does not compile (not that I expected it would).

So how would I code this and use ToLowerCase("LastName") and ToLowerCase("FirstName") in AS3?
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Case-insensitive sorting or custom function for sort

Post by Vladimir »

Hello,

Your code should look like this:

Code: Select all

band.sort = [ "ASC", "ToLowerCase(LastName)", "ASC", "ToLowerCase(FirstName)" ];
Thank you.
jakrzysztow
Posts: 18
Joined: Tue Aug 09, 2011 10:35 am

Re: Case-insensitive sorting or custom function for sort

Post by jakrzysztow »

That makes the program compile correctly, but there seems to be a problem with the actually sort.

I am trying to sort LastName, then FirstName.

For some reason, the LastName with the attached data sorts:
Oliveri, King, Thomas, Vulcani

I would expect:
King, Oliveri, Thomas, Vulcani

I also need a way to sort a column of data that is number-number (1-1, 2-1, 3-1, ... 10-1, 11-1). This does not sort correctly either...
Attachments
Data.csv
(1.25 KiB) Downloaded 639 times
OrderSummaryWithPoses.mrt
(38.24 KiB) Downloaded 675 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Case-insensitive sorting or custom function for sort

Post by Alex K. »

Hello,

Can you please send a test data which we can use for your report.

Thank you.
jakrzysztow
Posts: 18
Joined: Tue Aug 09, 2011 10:35 am

Re: Case-insensitive sorting or custom function for sort

Post by jakrzysztow »

Sorry for not being clear...Data.csv is the test data and the report is the OrderSummaryWithPoses.mrt. You don't have the AS3 code but the example in this thread is what I am using.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Case-insensitive sorting or custom function for sort

Post by Alex K. »

Hello,

Can you please send us a test data for your report.
As a way, you can use the following code in the BeforePrint event of the page for saving data as xml:
Order.DataTable.DataSet.WriteXmlSchema("e:\\data.xsd");
Order.DataTable.DataSet.WriteXml("e:\\data.xml");

Thank you.
jakrzysztow
Posts: 18
Joined: Tue Aug 09, 2011 10:35 am

Re: Case-insensitive sorting or custom function for sort

Post by jakrzysztow »

So I have to add "BeforePrint" event listeners to the Viewer to do this or some other piece of the StiReporting package?

And the above works in Flex?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Case-insensitive sorting or custom function for sort

Post by Alex K. »

Hello,

The code in events is not supported in flex version. As a way, you can try to run the standalone designer and save data as .xml or you can use other methods for save and sent us a test data which we can you use in your report for testing.

Thank you.
Locked