How to get specific row from Dataset in RDLC report

10,830

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.

Share:
10,830
Fame th
Author by

Fame th

Updated on July 25, 2022

Comments

  • Fame th
    Fame th almost 2 years

    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 
    
    • Anup Agrawal
      Anup Agrawal over 8 years
      Can you also show what is your expected result?
    • Fame th
      Fame th over 8 years
      I edited for adding expected result.
  • Fame th
    Fame th over 8 years
    Oh, I don't know before!! Thank you very much.