Page 1 of 1

Expression in before render event to order data

Posted: Tue Sep 10, 2019 5:26 pm
by rafael.custodio
Hi !! I´m trying to order some data in a report using the expression below in the before render event of a DataBand but it´s not working.

if DataBand.Date <= (01/03/2019){
DataBand.Sort = new string[] {"ASC","Clients.Name"};
}else{
DataBand.Sort = new string[] {"ASC","Clients.Date"};
}

Any thoughts ??

Re: Expression in before render event to order data

Posted: Wed Sep 11, 2019 8:39 pm
by Lech Kulikowski
Hello,

Should be:
DataBand.Sort = new string[] {"ASC","Name"};
}else{
DataBand.Sort = new string[] {"ASC","Date"};
}

Thank you.

Re: Expression in before render event to order data

Posted: Fri Sep 13, 2019 12:03 pm
by rafael.custodio
Hi Lech !! Thanks for replying, I tried and still not working, the order is not applied to the data band. I even tried just the expression below to check and it didn't work.

DataInfoAlumnoBr.Sort = new string[] {"ASC","Nombre"};

Also, I'm getting the error below:
Capturar.JPG
Capturar.JPG (29.94 KiB) Viewed 2237 times

Re: Expression in before render event to order data

Posted: Fri Sep 13, 2019 3:00 pm
by Lech Kulikowski
Hello,

Due to the error, you try to compare different types - DateTime and Integer.
Please send us a sample report with test data which reproduces the issue for analysis.

Thank you.

Re: Expression in before render event to order data

Posted: Wed Sep 18, 2019 3:23 pm
by rafael.custodio
Here are the sample report and data.

Re: Expression in before render event to order data

Posted: Thu Sep 19, 2019 8:54 am
by Lech Kulikowski
Hello,

Column FechaIncorporacionCentro is DateTime, should be:
if (InfoAlumnoBr.FechaIncorporacionCentro <= DateSerial(2019,01,03)){
...

Thank you.

Re: Expression in before render event to order data

Posted: Thu Sep 19, 2019 11:42 am
by rafael.custodio
Hi Lech !! thanks for replying, the error is gone but the expression still not ordering the results.

if(InfoAlumnoBr.FechaIncorporacionCentro <= DateSerial(2019,01,03)){
DataInfoAlumnoBr.Sort = new string[] {"ASC","Nombre"};
}else{
DataInfoAlumnoBr.Sort = new string[] {"ASC","FechaIncorporacionCentro"};
}
Capturar.JPG
Capturar.JPG (72.07 KiB) Viewed 2197 times

Re: Expression in before render event to order data

Posted: Sun Sep 22, 2019 4:02 pm
by Lech Kulikowski
Hello,

The logic of that code is wrong. You try to change sorting for each row of that data. Which value should be used in that expression:
InfoAlumnoBr.FechaIncorporacionCentro <= 01/03/2019

Thank you.