Expression in before render event to order data
-
- Posts: 31
- Joined: Thu May 30, 2019 1:01 pm
Expression in before render event to order data
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 ??
if DataBand.Date <= (01/03/2019){
DataBand.Sort = new string[] {"ASC","Clients.Name"};
}else{
DataBand.Sort = new string[] {"ASC","Clients.Date"};
}
Any thoughts ??
-
- Posts: 6259
- Joined: Tue Mar 20, 2018 5:34 am
Re: Expression in before render event to order data
Hello,
Should be:
DataBand.Sort = new string[] {"ASC","Name"};
}else{
DataBand.Sort = new string[] {"ASC","Date"};
}
Thank you.
Should be:
DataBand.Sort = new string[] {"ASC","Name"};
}else{
DataBand.Sort = new string[] {"ASC","Date"};
}
Thank you.
-
- Posts: 31
- Joined: Thu May 30, 2019 1:01 pm
Re: Expression in before render event to order data
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:
DataInfoAlumnoBr.Sort = new string[] {"ASC","Nombre"};
Also, I'm getting the error below:
-
- Posts: 6259
- Joined: Tue Mar 20, 2018 5:34 am
Re: Expression in before render event to order data
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.
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.
-
- Posts: 31
- Joined: Thu May 30, 2019 1:01 pm
Re: Expression in before render event to order data
Here are the sample report and data.
- Attachments
-
- Lista_de_alunos_20190918_151300.XML
- (762.58 KiB) Downloaded 125 times
-
- Relação de Alunos OrdenacaoPallas.mrt
- (42.5 KiB) Downloaded 130 times
-
- Posts: 6259
- Joined: Tue Mar 20, 2018 5:34 am
Re: Expression in before render event to order data
Hello,
Column FechaIncorporacionCentro is DateTime, should be:
if (InfoAlumnoBr.FechaIncorporacionCentro <= DateSerial(2019,01,03)){
...
Thank you.
Column FechaIncorporacionCentro is DateTime, should be:
if (InfoAlumnoBr.FechaIncorporacionCentro <= DateSerial(2019,01,03)){
...
Thank you.
-
- Posts: 31
- Joined: Thu May 30, 2019 1:01 pm
Re: Expression in before render event to order data
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"};
}
if(InfoAlumnoBr.FechaIncorporacionCentro <= DateSerial(2019,01,03)){
DataInfoAlumnoBr.Sort = new string[] {"ASC","Nombre"};
}else{
DataInfoAlumnoBr.Sort = new string[] {"ASC","FechaIncorporacionCentro"};
}
-
- Posts: 6259
- Joined: Tue Mar 20, 2018 5:34 am
Re: Expression in before render event to order data
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.
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.
- Attachments
-
- Annotation 2019-09-22 180246.jpg (385.56 KiB) Viewed 2173 times