Click here to Skip to main content
15,898,538 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi 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?

Thanks.
Posted
Updated 25-Nov-12 22:50pm
v5
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900