Concatenating datafields

Forum Forums SI 2015 Reporting Concatenating datafields

This topic contains 6 replies, has 2 voices, and was last updated by  Tim Ogletree 2 years ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #6779 Reply

    Tim Ogletree
    Participant

    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.

    #9009 Reply

    Tim Ogletree
    Participant

    Is it that difficult? Support? Anyone?

    #9012 Reply

    Seth Enos
    Moderator

    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.

    [attachment=367]fields.jpg[/attachment]

    The scripting used is:

    Sub PageHeader1_Format

    dim city as String = ReportUtilities.ReturnTextBoxValue(rpt,”PageHeader1″,”txtCity”)
    dim state as String = ReportUtilities.ReturnTextBoxValue(rpt,”PageHeader1″,”txtState”)
    dim concat as String = city & “,” & ” ” & State

    ReportUtilities.SetTextBoxValue(rpt,”PageHeader1″,”txtCon”,concat)

    End Sub

    The results when run are:

    [attachment=368]results.jpg[/attachment]

    #9013 Reply

    Tim Ogletree
    Participant

    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?

    #9019 Reply

    Tim Ogletree
    Participant

    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.

    #9022 Reply

    Seth Enos
    Moderator

    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]

    #9024 Reply

    Tim Ogletree
    Participant

    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.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: Concatenating datafields
Your information:





<a href="" title="" rel="" target=""> <blockquote cite=""> <code> <pre> <em> <strong> <del datetime=""> <ul> <ol start=""> <li> <img src="" border="" alt="" height="" width="">