Click here to Skip to main content
11,920,211 members (48,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 22:03pm
Edited 25-Nov-12 23: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
0 OriginalGriff 455
1 phil.o 170
2 CPallini 150
4 F-ES Sitecore 130
0 OriginalGriff 6,778
1 KrunalRohit 4,495
2 Sergey Alexandrovich Kryukov 3,153
3 George Jonsson 2,810
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web03 | 2.8.151120.1 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2015
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