How to get specific row from Dataset in RDLC report

Fame th picture Fame th · Sep 15, 2015 · Viewed 9k times · Source

I have three textboxes. Each text box will show a value which get from first row, second row and third row of "MyDataset" Dataset.

My Dataset contain about these

 ____SEQ_NO____|____USER__
      1        |  Beckham
      2        |  Cantona
      3        |   Depay

So I created hidden tablix for binding Dataset and get values from each cell. My tablix include with

ROW1 Column for display USER from first row of dataset

ROW2 Column for display USER from second row of dataset

ROW3 Column for display USER from third row of dataset

I try to use this expression for each Column.

For ROW1

        =Lookup(Fields!SEQ_NO.Value,1, Fields!USER.Value, "MyDataset") 

For ROW2

        =Lookup(Fields!SEQ_NO.Value,2, Fields!USER.Value, "MyDataset") 

For ROW3

        =Lookup(Fields!SEQ_NO.Value,3, Fields!USER.Value, "MyDataset") 

But It's wrong. I don't understand. Why it show only first row like result below.

  _SEQ_NO___|___ROW1__|___ROW2__|___ROW3___
      1     | Beckham |         |  
      2     |         | Beckham |           
      3     |         |         |  Beckham

###### My Expected Result should be like below. #####

  _SEQ_NO___|___ROW1__|___ROW2__|___ROW3___
      1     | Beckham |         |  
      2     |         | Cantona |           
      3     |         |         |  Depay

If this is a correct. My three textbox can refer each specific row by this expression

 **For Textbox1**

         =ReportItems!ROW1.Value 

 **For Textbox2**

         =ReportItems!ROW2.Value 

 **For Textbox3**

         =ReportItems!ROW3.Value 

Answer

Anup Agrawal picture Anup Agrawal · Sep 15, 2015

You need to switch your first two parameters of lookup function.

 =Lookup(1, Fields!SEQ_NO.Value, Fields!USER.Value, "MyDataset") 

 =Lookup(2, Fields!SEQ_NO.Value, Fields!USER.Value, "MyDataset")  

 =Lookup(3, Fields!SEQ_NO.Value, Fields!USER.Value, "MyDataset")  

The way it was specified by you =Lookup(Fields!SEQ_NO.Value,1,.... will cause it to return multiple values. That's why it was just showing the data from the first row.