Page 1 of 1

Output DataSource items as a concatenated string?

Posted: Thu Jan 19, 2012 10:02 am
by ColinDaly
Hi,

We have a DataSource in our report that has a similar shape to:

Key | Value
-----------------------
1 | Value1
2 | Value2

We require a concatenated string ('Key = Value, '...repeat) of the results to be in the report i.e. '1 = Value1, 2 = Value2'....can you provide an example of how this could be achieved?

Regards,

Col

Output DataSource items as a concatenated string?

Posted: Fri Jan 20, 2012 3:01 am
by HighAley
Hello.
ColinDaly wrote:We have a DataSource in our report that has a similar shape to:

Key | Value
-----------------------
1 | Value1
2 | Value2

We require a concatenated string ('Key = Value, '...repeat) of the results to be in the report i.e. '1 = Value1, 2 = Value2'....can you provide an example of how this could be achieved?
We have no final solution, but there could be a workaround.
To say something certain we need to know what product do you use Designer.Web with.

Generally, the better way is to prepare a string in advance and send it to the report.

Thank you.

Output DataSource items as a concatenated string?

Posted: Fri Jan 20, 2012 5:29 am
by ColinDaly
Thanks for the reply, I guessed this may be the response. Do you recommend using a variable for this task?

Output DataSource items as a concatenated string?

Posted: Mon Jan 23, 2012 9:27 am
by HighAley
Hello.
ColinDaly wrote:Thanks for the reply, I guessed this may be the response. Do you recommend using a variable for this task?
Here is a sample code for this before compilation:

Code: Select all

StiReport report = new StiReport();
report.Load("d:\\stimulsoft\\1\\ReportArguments2.mrt");
report.Dictionary.Variables["Variable1"].Value = yourCancatenatedString;
report.Compile();
report.Render(false);
report.Show();
or after compilation:

Code: Select all

report.Compile();
report["Variable1"] = yourCancatenatedString;
report.Render(false);
report.Show();
Thank you.