Previous () Function Not Working

Stimulsoft Reports.NET discussion
Don Brown
Posts: 6
Joined: Thu Dec 10, 2015 7:06 pm

Previous () Function Not Working

Post by Don Brown »

I am trying to condition highlighting on a comparison between the current row value and the previous row value. I added a Highlight Condition and put the following values in the Conditions form:

Value | String | rptTable.Op1_Color

not equal to | Previous (DataBand1, rptTable.Op1_Color)

Highlighting set to Light Gray.

I get no response from the Previous ()function in the above. So I tried one more thing: I created a temporary text box on the report with this in the text box: {Previous(DataBand1,rptTable.Op1_Color)}. It is always empty, even though the previous row always has a value.

There is no reference in any of your Help documents about the Previous () function, examples, formats, or any help at all.

I need your help. Do the Print State functions actually work? If so, show me how to compare one line to the previous.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Previous () Function Not Working

Post by Alex K. »

Hello,

Please try to use the Expression type for the "Field Is" option in the Condition and use the following expression:

Code: Select all

rptTable.Op1_Color != Previous(rptTable,"Op1_Color") 
Thank you.
Don Brown
Posts: 6
Joined: Thu Dec 10, 2015 7:06 pm

Re: Previous () Function Not Working

Post by Don Brown »

I set a Highlight condition for 'Field Is" Expression and entered the expression field you suggested

rptTable.Op1_Color != Previous (rptTable, "Op1_Color").

When I run the report in Preview, no warnings. When I save it and run it from the Application, I get the message box with message: "Unable to use Report File C:\ . . .\Report.mrt. Please have its validity verified."

Something is still wrong with the solution.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Previous () Function Not Working

Post by Alex K. »

Hello,

Please clarify which product and which version are you use?

Thank you.
Don Brown
Posts: 6
Joined: Thu Dec 10, 2015 7:06 pm

Re: Previous () Function Not Working

Post by Don Brown »

I am using Stimulsoft Reports.Ultimate.2011.2 for this project.

I also have Stimulsoft Reports.Net 2014.3, but when I use 2014.3 the Panel 1 container in the report turns Red. It does not work with this report.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Previous () Function Not Working

Post by Alex K. »

Hello,

Can you please send us your report with test data for analysis.

Thank you.
Don Brown
Posts: 6
Joined: Thu Dec 10, 2015 7:06 pm

Re: Previous () Function Not Working

Post by Don Brown »

I have added a MS SQL Server 2012 database and a copy of the report to this email.

The purpose of using the Previous() function is to change all text boxes on the DataBand1 line to display a background of Light Gray when the value on the current row is different from the value on the previous row.

The report has only one text box Text15 containing the condition and filter code set with the Appearance properties set to rptNeedleAssignments.Op1_Thread != Previous (rptNeedleAssignments, "Op1_Thread"). After Text15 works we will use the same code to set all 14 text boxes to the right to the same condition.
Attachments
EmbTrak_Stimulsoft_Small.rar
This is a copy of MS SQL Server 2012 EmbTrak database. It contains Tables NeedleAssignment and Machines and View ConesReq and Stored Procedure rptNeedleAssignments
(1.12 MiB) Downloaded 598 times
NA12wOneFilter.mrt
Copy of Report
(62.58 KiB) Downloaded 229 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Previous () Function Not Working

Post by Alex K. »

Hello,

The Previous function return object value and your column is string. Pleas try to use the following expression:
rptNeedleAssignments.Op1_Thread != Previous(rptNeedleAssignments,"Op1_Thread").ToString()

Thank you.
Don Brown
Posts: 6
Joined: Thu Dec 10, 2015 7:06 pm

Re: Previous () Function Not Working

Post by Don Brown »

I put in exactly what you said (rptNeedleAssignments.Op1_Thread != Previous(rptNeedleAssignments,"Op1_Thread").ToString()) and got the same result--the message ". . .mrt. Please have its validity verified". The Expression condition does not seem to work with any condition. I even tried entering a very simple 1==1 expression and got the same error message. Does the Value Condition even work or is it broken??
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Previous () Function Not Working

Post by Alex K. »

Hello,

Please check the modified report in the attachment.

Thank you.
Attachments
Capture.PNG
Capture.PNG (56.32 KiB) Viewed 6778 times
NA12wOneFilter3.mrt
(46.47 KiB) Downloaded 516 times
Post Reply