Click here to Skip to main content
13,199,296 members (73,124 online)
Rate this:
Please Sign up or sign in to vote.
I am new to SSRS and I want to call two datasets in a single table in a single report.I'm trying to use the LOOKUP function in order to lookup information in a second data source. The expression I used is

=Lookup(Fields!DISTRIBUTOR_ID.Value, Fields!D0030_DISTRIBUTOR_ID.Value, Fields!D0030_LINE_LOSS_FACTOR_CLASS_ID.Value, "DataSet2")

and I used DataSet1 initially in my table.

But when previewing the report, I got the error message:

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

And when I type Lookup in my expression I get the red squiggly lines under it.

Any ideas?

Posted 25-Nov-12 21:03pm
Updated 25-Nov-12 22:50pm
Rohit Shrivastava 26-Nov-12 15:00pm
I am not sure about the schema of your datasets

Lookup(Fields!DISTRIBUTOR_ID.Value, Fields!D0030_DISTRIBUTOR_ID.Value, Fields!D0030_LINE_LOSS_FACTOR_CLASS_ID.Value, "DataSet2")

D0030_DISTRIBUTOR_ID should be in dataset2 which needs to be matched with current dataset field value i.e. DISTRIBUTOR_ID.Value (shoule be in the dataset to which table is bind)
Fields!D0030_LINE_LOSS_FACTOR_CLASS_ID.Value should be a field in Dataset2 which needs to be picked up when value matches.
Dhivya.J 27-Nov-12 0:08am
Thank u for your reply. Ya I have used the fields exactly as you said.. But still I m getting those errors which i mentioned earlier.. thats wer my problem is... Pls help..
Rohit Shrivastava 27-Nov-12 15:48pm
I tried developing a report and was able to successfully use lookup, could you please post content of your rdl file as xml. which might help in identifying the actual problem here. please check for proper case of field name.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171020.1 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100