Page 1 of 2

Case-insensitive sorting or custom function for sort

Posted: Thu Jun 27, 2013 7:44 pm
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.

Re: Case-insensitive sorting or custom function for sort

Posted: Mon Jul 01, 2013 11:00 am
by Vladimir
Hello,

You can use the following expression in the sort condition:

Code: Select all

ToLowerCase(ColumnName)
Thank you.

Re: Case-insensitive sorting or custom function for sort

Posted: Mon Jul 01, 2013 3:12 pm
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?

Re: Case-insensitive sorting or custom function for sort

Posted: Tue Jul 02, 2013 7:05 am
by Vladimir
Hello,

Your code should look like this:

Code: Select all

band.sort = [ "ASC", "ToLowerCase(LastName)", "ASC", "ToLowerCase(FirstName)" ];
Thank you.

Re: Case-insensitive sorting or custom function for sort

Posted: Mon Jul 08, 2013 8:23 pm
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...

Re: Case-insensitive sorting or custom function for sort

Posted: Wed Jul 10, 2013 1:24 pm
by Alex K.
Hello,

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

Thank you.

Re: Case-insensitive sorting or custom function for sort

Posted: Thu Jul 11, 2013 2:42 pm
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.

Re: Case-insensitive sorting or custom function for sort

Posted: Fri Jul 12, 2013 12:22 pm
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.

Re: Case-insensitive sorting or custom function for sort

Posted: Tue Jul 16, 2013 6:02 pm
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?

Re: Case-insensitive sorting or custom function for sort

Posted: Wed Jul 17, 2013 12:14 pm
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.