3

I've been working on reports using SQL Server Reporting Services and I've come with a problem.

I have a report that contains multiple datasets. Let's say I have those datasets:

  • DatasetPotatoes
  • DatasetUnicorns
  • DatasetJobs

My report is using a XML to get the value of my fields. Let's say my XML is the following :

<XML>
    <Jobs>
        <string>Job1</string>
        <string>Job2</string>
        <string>Job3</string>
    </Jobs>
    <Potatoes>
        <id>123</id>
        <fieldname>blabla</fieldname>
    </Potatoes>
</XML>

I'd like to be able to put in a single textbox all the values of my List(Of String) (so all my <string> values) are like that : Job1, Job2, Job3.

Here is an example of how my textbox are populated using an expression:

=First(Fields!fieldname.Value, "DatasetPotatoes")

Do you know if it's possible to get all my <string></string> values? Or a least get an array of my <string></string> values so I can format it using VB.NET code?

Carlos
  • 1,638
  • 5
  • 21
  • 39
  • Possible duplicate of [trying to serialize and deserialize an xml file using VB.net](http://stackoverflow.com/questions/24246002/trying-to-serialize-and-deserialize-an-xml-file-using-vb-net) – Inspector Squirrel Dec 02 '15 at 18:25
  • Thanks for your answer. The problem isn't about the tag "string" itself, but about joining all string values in one single textbox. – Jérémy Gagné Dec 02 '15 at 19:56
  • Since I can't edit for 5 minutes, here is another answer. Here is the mapping of the field : =RunningValue(Code.ConcatenerString(Fields!string.Value),Max,"ObjetProtectionsDemandees") Here is the little homemade function: Dim test as String = String.Empty Function ConcatenerString(_string as String) As String test = test & _string & "," Return test End Function Since it's working, I wonder if it's dangerous to use it, it looks like a shared variable, so it could be dangerous to make other reports at the same time ? – Jérémy Gagné Dec 02 '15 at 20:03

3 Answers3

1

Set up a parameter using a query/dataset that defaults and available to all of the values/items you wish to be shown together in one field.

on the report insert a field and set the expression to be :

=join(Parameters!Parameters.Value, " , " )

View the report and all of the items will appear in a single field.

SuperSimmer 44
  • 964
  • 2
  • 7
  • 12
1

Maybe this is useful for someone: if you need this outside any data region, and you do not want to create a parameter, this way works for me:

=Join(LookupSet(1, 1, Fields!Name.Value,"SalesMen"),", ")

I use it because I think it is clearer than using a parameter.

Carlos
  • 1,638
  • 5
  • 21
  • 39
0

So for this you want to do the following

  1. create a new data set.
  2. add the parameter.
  3. on the report insert a field and set the expression to be :
=join(Parameters!Parameters.Value, " , " )