September 19, 2015 at 10:32 pm #6779
Working on customizing some reports. Can’t figure out how to concatenate multiple datafields in a textbox. For a simple example, say I want to combine the City and State fields into a single textbox separated by a comma.September 22, 2015 at 2:03 pm #9009
Is it that difficult? Support? Anyone?September 22, 2015 at 9:21 pm #9012
Our reports are written in VB.NET and here is some information on concatenation operators.
Attached is a report named “Concatenation” with scripting to pull off what you are attempting. It will appear under the Clients report Category when imported. It has two data fields added, City and State, and a results field.
The scripting used is:
dim city as String = ReportUtilities.ReturnTextBoxValue(rpt,”PageHeader1″,”txtCity”)
dim state as String = ReportUtilities.ReturnTextBoxValue(rpt,”PageHeader1″,”txtState”)
dim concat as String = city & “,” & ” ” & State
The results when run are:
[attachment=368]results.jpg[/attachment]September 25, 2015 at 6:53 pm #9013
Thanks Seth, that helps. What if I don’t actually want the City & State fields in the report but just the concatenated field. How can I reference a Bound XML data? Is there a function like:
dim city as String = ReportUtilities.ReturnDataValue(rpt,”whatever the reference is“) in order to get the value directly from the data reference? Please advise. Is there a reference document you guys have that would show these methods?September 28, 2015 at 12:39 am #9019
So after a little research over the weekend I found plenty of good reference for ActiveReports and using scripting to achieve all sorts of cool things. However, I’m still unclear on how to reference bound data in the scripting. If you could help me out with an example of this or point me to a report to look at I’d appreciate it.September 28, 2015 at 1:30 pm #9022
I am not sure I understand your question. Are you asking how to not show the City and State fields on the report and only show the concatenated field? If so, you can simply make the City and State (or whatever) fields not display on the report. We do this quite often on our stock reports. Anywhere you see a little colored box is an indication of “non-visible referenced fields”. You will want to choose a fill color, make it small, make it not visible, and remove the text from the field (not sure this last step is necessary but I am a creature of habit):
[attachment=370]invisiblefields.jpg[/attachment]September 29, 2015 at 2:42 am #9024
Sure, I gathered it could be done that way. But I was assuming there should be some way in the scripting to directly reference the report data without having to drop in a text box with a reference.