Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server-2008 SSRS
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 25-Nov-12 22:03pm
Edited 25-Nov-12 23:50pm
v5
Comments
Rohit Shrivastava at 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 at 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 at 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 275
1 Maciej Los 230
2 Sergey Alexandrovich Kryukov 185
3 Afzaal Ahmad Zeeshan 152
4 ProgramFOX 130
0 OriginalGriff 6,524
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,218
3 Manas Bhardwaj 4,657
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2014
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