Referencing Data Fields in Variables
Referencing Data Fields in Variables
Hi Stimulsoft,
I am attempting to render several fields within label using a variable. I'm attempting this because the variable name will always be the same, versus the label name having a potentially different name.
For example, if I have a datasource "Transactions" with 6 fields:
- Date
- Item
- Item Description
- Cost
- PersonID
- PersonName
I am able to render any number of fields in the group header label using {Transactions.Item} - {Transactions.Description}.
But, If I create a variable of type string using a value type of Expression named "GroupLabel" and set the expression to "Transactions.Item", nothing is shown. If I set the Expression to "Transactions.Item + "B"", only the "B" character is shown.
Is it possible to render data fields within variables?
If so, how?
Thanks.
I am attempting to render several fields within label using a variable. I'm attempting this because the variable name will always be the same, versus the label name having a potentially different name.
For example, if I have a datasource "Transactions" with 6 fields:
- Date
- Item
- Item Description
- Cost
- PersonID
- PersonName
I am able to render any number of fields in the group header label using {Transactions.Item} - {Transactions.Description}.
But, If I create a variable of type string using a value type of Expression named "GroupLabel" and set the expression to "Transactions.Item", nothing is shown. If I set the Expression to "Transactions.Item + "B"", only the "B" character is shown.
Is it possible to render data fields within variables?
If so, how?
Thanks.
Re: Referencing Data Fields in Variables
Hello,
Can you please send us your report with test data which reproduce the issue for analysis.
Thank you.
Can you please send us your report with test data which reproduce the issue for analysis.
Thank you.
Re: Referencing Data Fields in Variables
I am very sorry for the delay in responding.
I have attached an example that illustrates the issue I am having.
There are two columns: Products.UnitPrice and Products.UnitsInStock
If I create a simple text expression with a value of:
I get the expected result (ex. 2 * 3 = 6)
If I create a variable ("TotalValue" in the sample), and attempt to do the same thing:
I always get 0.
Am I doing something wrong?
Thanks!
I have attached an example that illustrates the issue I am having.
There are two columns: Products.UnitPrice and Products.UnitsInStock
If I create a simple text expression with a value of:
Code: Select all
{Products.UnitPrice * Products.UnitsInStock}
If I create a variable ("TotalValue" in the sample), and attempt to do the same thing:
Code: Select all
Products.UnitPrice * Products.UnitsInStock
Am I doing something wrong?
Thanks!
- Attachments
-
- STIEXAMPLE.zip
- MRT with example xsd/xml source
- (3.01 KiB) Downloaded 232 times
Re: Referencing Data Fields in Variables
Hello.
Please, try to set Read Only option of the variable.
Then the expression will be calculated on each request.
You could read more information about this option on the User Manual.
Thank you.
Please, try to set Read Only option of the variable.
Then the expression will be calculated on each request.
You could read more information about this option on the User Manual.
Thank you.
Re: Referencing Data Fields in Variables
Thank you for the clarification Aleksey. Works like a champ!
Re: Referencing Data Fields in Variables
Hello,
Thank you and have a nice day!
Thank you and have a nice day!