Forum Discussion

RobertRR's avatar
RobertRR
Frequent Visitor
2 years ago

How to display objects in a grouping

I would like to know if there is any way to display the query values for an external data source in object format and not in plain text with the concatenated values. To do this, I need to create a grouping in a matrix displaying the grids horizontally.

Here is an example grid displaying each record returned from the query, one grid next to the other:

Now I am using the Join and Lookup Set function to fetch the query data from another dataset. I'm using the exact same grouping function on the expression in the text field you can see selected in the report:

The result is this, the grouping did not result in anything, just the expression in the text field that resulted in the concatenated values. But I don't want that, I want to create new objects for each record found. Does anyone have any ideas on how to do this, would custom code be required? Grids displaying correctly on first print is only possible because they are in the same dataset.

 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi RobertRR ,

    You want to display the query value of the external data source in object format, not in plain text with the join value. This may require custom code.

    Best Regards,

    Xianda Tang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • RobertRR's avatar
      RobertRR
      Frequent Visitor

      I understand, I expected that. However, I have no idea how to do this with custom code, I searched the Microsoft documentation and didn't find anything related. I would be grateful if you could help me find a code example.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi RobertRR ,

        Here is the sample:

        Public Function GetUsers(ByVal param As Integer) As String
            Dim sqlCon As New System.Data.SqlClient.SqlConnection
            Dim cmd As New System.Data.SqlClient.SqlCommand
            Dim dRet As String
            Dim sCmdText As String
        
            sqlCon.ConnectionString = "data source=MYSERVER;initial catalog=MYDB;Integrated Security=true"
        
            cmd = New System.Data.SqlClient.SqlCommand
            sCmdText = "SELECT dbo.udf_MyFunction(" 
            'cmd.CommandType = CommandType.Text
            cmd.Connection = sqlCon
            cmd.CommandTimeout = 0
        
            sCmdText = sCmdText & param
            sCmdText = sCmdText & ")"
        
            cmd.CommandText = sCmdText
            If sqlCon.State <> System.Data.ConnectionState.Open Then
            sqlCon.Open()
            End If
            dRet = cmd.ExecuteScalar() & ""     
            sqlCon.Close()
        
            Return dRet
        
        End Function

        Below is the official link will help you:

        Custom code and assembly references in expressions in a paginated report in Report Designer - Microsoft Report Builder & Power BI Report Builder | Microsoft Learn

        Best Regards,

        Xianda Tang

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.