Page 1 of 1

Always evaluate expression when variable gets used

Posted: Mon Nov 02, 2015 10:31 am
by Roland.K
We've added some helper methods to our report viewing & editing application to use runtime data within the report fields and the query without having to add code to the report's C# code.

If the helper code is used from within the query, we're adding it to an expression-typed variable within the report's dictionary.

When viewing / previewing the report, everything works as expected, but when simply executing the command (query) from within the dictionary, the user gets queried for the variables, pre-filled with the expression set in the variable.

Example:
* variable named "SiteNr" within the dictionary, having "WinTool.LocalSiteNr" as expression content (w/o quotes)
* used as {SiteNr} within the query
* when viewing the report, the variable gets replaced with e.g. "1"
When using "View Data" on the query within the dictionary, a popup is shown, that asks the user for the value of "{SiteNr}" and pre-fills the textbox with "WinTool.LocalSiteNr"

Is there a way to always evaluate variables - no matter if the report gets actually rendered, or only the query gets executed?

Note: we're currently stuck at STI 2013.2, but intend to upgrade to a newer STI probably with the next major release of our software.

Re: Always evaluate expression when variable gets used

Posted: Tue Nov 03, 2015 7:37 am
by HighAley
Hello.

Please, try to set the Read Only option of the variable.

Thank you.

Re: Always evaluate expression when variable gets used

Posted: Tue Nov 03, 2015 9:41 am
by Roland.K
Hi Aleksey,

sadly this wasn't successful. I'm still being presented with the "SQL Expressions" input box even after setting "Read Only":
2015-11-03 10_33_44-SQL Expressions.png
2015-11-03 10_33_44-SQL Expressions.png (10.51 KiB) Viewed 3011 times
2015-11-03 10_34_20-Edit Variable.png
2015-11-03 10_34_20-Edit Variable.png (27.2 KiB) Viewed 3011 times
This is, how it's used within the query:
2015-11-03 10_35_07-Edit Data Source.png
2015-11-03 10_35_07-Edit Data Source.png (760 Bytes) Viewed 3011 times
Please remember - I'm using STI.Net 2013.2 - may you have changed / repaired this in a later version?

Re: Always evaluate expression when variable gets used

Posted: Tue Nov 03, 2015 11:41 am
by Alex K.
Hello,

View Data is additional option and for each run you need set values for all parameters or expression which uses in the query.

Thank you.

Re: Always evaluate expression when variable gets used

Posted: Tue Nov 03, 2015 11:58 am
by Roland.K
Sorry, seems I don't really understand what you mean.... Do you simply mean "this isn't possible for View Data"?

Would you consider adding this in a future release? (for View Data and any other Access to content from a variable, e.g. "Retrieve Columns")

Re: Always evaluate expression when variable gets used

Posted: Tue Nov 03, 2015 12:56 pm
by Alex K.
Hello,

For view data and retrieve columns parameters/expression value gets from the default value of the variable, if you are uses the expression and the ReadOnly option, value calculated before render report.
Sorry, but we have not plans to change this behaviour.

Thank you.

Re: Always evaluate expression when variable gets used

Posted: Tue Nov 03, 2015 1:53 pm
by Roland.K
Thank you Aleksey,

I'm really sorry to keep annoying you... but are there any other means to use data retrieved by Code within the query w/o the "SQL Expressions" pop-up?

Re: Always evaluate expression when variable gets used

Posted: Wed Nov 04, 2015 5:47 am
by Alex K.
Hello,

In your case, there is not any other way.
You can set the value directly in the query and view data - "... where SiteNr = YourValue". Also you can set the AllowExpression property for the datasource as false, but in this case you need use the default value for variables.

Thank you.