Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get specific row from Dataset in RDLC report

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 
like image 658
Fame th Avatar asked Sep 15 '15 13:09

Fame th


People also ask

How do you refresh a DataSet in Rdlc?

In visual studio if you have the RDLC open you can open the Report Data window by pressing CTRL + ALT + D . From here you click on datasets and then right click on the data set to refresh it. Save this answer.


1 Answers

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.

like image 61
Anup Agrawal Avatar answered Sep 17 '22 16:09

Anup Agrawal