Using report viewer, how do I pull from two seperate Datasets

11,697

Solution 1

After some careful research and error checking I found that I had to create my base model property file and when I drag the actual data points on to my form I had to associate them with their correct set:

enter image description here

I clicked the value and associated the correct dataset.

Solution 2

When you create a table in a RLDC, in the Tablix properties (selecting a row or a column) you must associate a DataSet.

After doing that, you have to write in each cell the name of the field (in the dataset) that you will use. You can do that by clicking on the "little table" in the cell, when you put the mouse over it

In images (with Visual Studio 2010)

Tablix Properties

Selecting DataSet

Setting Field to Show

If you don't see the dataset in the list, you must add it. For that, click on view menu -> report data. Then, in the DummyDataSource, click Add Dataset..

Add new DummyDataSource

And select it from the list, or create a new one instead, in the same form. enter image description here

If this doesn't work, well I don't know haha

If the two datasets has the same structure, then you could use one just, and in the code assign it to the datasource

Solution 3

I ran into this same error and the only way I could resolve it was by closing and reopening BIDS and then refreshing the fields from the stored procedure (Right click the data set -> Dataset Propoerties -> Query -> Refresh Fields).

Thanks for the troubleshooting tips!

Share:
11,697
Robert
Author by

Robert

Updated on June 09, 2022

Comments

  • Robert
    Robert almost 2 years

    I have two datasets I need to pull from, A base that both reports use and then a separate one that only one report pulls from. I get the error

    Error 12 The Value expression for the text box ‘Textbox9’ refers to the field ‘Name’. Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope.

    My best guess is I have to associate them with the correct dataset but I have not been able to find any documentation on this.

    edit: I am trying to access property files that I created for the fields on the report document.

    Can someone please tell me where in the rdlc document I need to code something like name.value, "dataset1" or something similar?

  • Robert
    Robert over 11 years
    I am not using a database as the stat set. I am actually using an object manually created from a properties file. We do not want to directly query the database repeatedly for the same data. We want it to live in memory. I have figured out what I have to do and I'll post my answer now
  • Robert
    Robert over 11 years
    Not quite what I am trying to do.
  • spr
    spr about 11 years
    how to create base model property file