Variables/calculated columns not working

Stimulsoft Reports.NET discussion
Post Reply
Artimidor
Posts: 38
Joined: Thu Jan 09, 2020 8:15 am

Variables/calculated columns not working

Post by Artimidor »

Hello there!

We try to display values in a table column based on a field in the data source table, something like this:

Left("XXXXXXXXXXXXXXXXXXXX",SalesPerCategories.Level)

Depending on the value in the field (e.g. 1, 2 or 3), the result should be either "X", "XX" or "XXX".

If we put the expression directly into the text field meant to display the value (with enclosing brackets {} of course), an object error is yielded, whereas an explicit use of a number e.g. {Left("XXXXXXXXXXXXXXXXXXXX",2)} works, but doesn't get us the results we require.

Now if we put the expression into a variable as shown in the screenshot, the expression is interpreted correctly... but only at design time, in the preview window (the designer uses the Java version as far as we understand). However, once we fill the report with actual data via .Net, the expression apparently cannot be interpreted. It's no different with a calculated column. Is this a bug in the Stimulsoft software? How would you explain the differing behavior?

And, most importantly: What would you recommend in a case like this? If we want to display fields based on expressions, where should we put it?

Thanks in advance,
Artimidor
Attachments
Screenshot 2020-11-02 112952.png
Screenshot 2020-11-02 112952.png (19.07 KiB) Viewed 2190 times
Lech Kulikowski
Posts: 6266
Joined: Tue Mar 20, 2018 5:34 am

Re: Variables/calculated columns not working

Post by Lech Kulikowski »

Hello,

We couldn't reproduce the issue on our samples.
Please send us a sample report with test data that reproduces the issue for analysis.

Thank you.
Artimidor
Posts: 38
Joined: Thu Jan 09, 2020 8:15 am

Re: Variables/calculated columns not working

Post by Artimidor »

Addition: In the process of trying to circumvent the issue we've come across another problem... This should be easily reproducable on your side, I guess. Maybe you have a solution for this one, that would be helpful too.

See the attached screenshots.

- I add a textbox to the data band.
- The text box is set to "Auto Width".
- In the text box, we use the attached expression to display the field with the intention of adding spaces ahead of the text, followed by the category level.
- The leading spaces are displayed, however they are ignored when the size of the field is being determined. If the space is replaced with a character like "x" the text boxes stretches properly.

Looks like a bug - or is there a reason for this behavior? How can we make sure that the whole string expression we put together is displayed?

Thanks for any input!
Attachments
Screenshot 2020-11-05 131306.png
Screenshot 2020-11-05 131306.png (7.48 KiB) Viewed 2133 times
Artimidor
Posts: 38
Joined: Thu Jan 09, 2020 8:15 am

Re: Variables/calculated columns not working

Post by Artimidor »

And regarding the original issue, here's the report (see attachment, Categories.json is the report, SalesByCategory.json the data source).

You can see the problem e.g. with field txtIndentLeftLevelRest. Is displayed properly at design time, but doesn't work at run time.
Attachments
SalesByCategory.json
(7.8 KiB) Downloaded 98 times
Categories.json
(79.14 KiB) Downloaded 111 times
Lech Kulikowski
Posts: 6266
Joined: Tue Mar 20, 2018 5:34 am

Re: Variables/calculated columns not working

Post by Lech Kulikowski »

Hello,

We couldn't reproduce the issue. Please provide more detailed information on how to reproduce the issue.

Thank you.
Attachments
Screenshot 2020-11-05 150329.jpg
Screenshot 2020-11-05 150329.jpg (145.37 KiB) Viewed 2131 times
Artimidor
Posts: 38
Joined: Thu Jan 09, 2020 8:15 am

Re: Variables/calculated columns not working

Post by Artimidor »

Report file I uploaded looks perfectly fine from here (see upper half of attached image), so I'm not sure what you're doing there. Maybe it should be renamed to mrt to load in your environment?

Regardless, the main issue remains, independent from this particular report. The general question I'd like to have answered is (see comparison of the lower two images):

Is it intended behavior that there's an object error when we press "Check" at the Left function, which uses a decimal data field? "Check" displays an error. Preview seems to ignore this error, however, and the expression is resolved regardless (see upper screenshot). Why the discrepancy? Can you see this discrepancy too?
Attachments
aaa.png
aaa.png (94.77 KiB) Viewed 2116 times
Lech Kulikowski
Posts: 6266
Joined: Tue Mar 20, 2018 5:34 am

Re: Variables/calculated columns not working

Post by Lech Kulikowski »

Hello,

We have added that task to our to-do list, we will fix the error checker message in the next builds.

Thank you.
#2983
Lech Kulikowski
Posts: 6266
Joined: Tue Mar 20, 2018 5:34 am

Re: Variables/calculated columns not working

Post by Lech Kulikowski »

Hello,

The issue was fixed.

Thank you.
Post Reply