Lookup function Failure.
Hi,
I have report where for particular field i am using an expression called.
=Lookup(Fields!Transaction_Number,Fields!TransactionNumber,Fields!Credit.Value,
"Overrides")
But i am getting values like #Error.
In the error list i am getting this error
Warning 1 [rsLookupOfInvalidExpressionDataType] The Value expression for the textrun ‘Credit3.Paragraphs[0].TextRuns[0]’ uses a lookup function with an expression
that returned a data type that is not valid for the lookup function. The data type must be an RDL Variant type.
Transaction Number is of Varchar Type.
Any ideas? why lookup is functioning like this.
Thanks
September 8th, 2011 4:17pm
SSASStarter,
Try modifying the type of TransactionNumber inside Lookup(),
=Lookup( CStr(Fields!Transaction_Number) , CStr(Fields!TransactionNumber), CInt(Fields!Credit.Value) ,
"Overrides")
Let me know if it helps.
Regards,
Manoj
*Happy to help
http://experiencingmsbi.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
September 9th, 2011 5:16am
Hi,
Make sure your Transaction Number from Both datasets are of same datatype Varchar.Rakesh M J
Dont forget to mark it as Answered if found useful
MCTS,MCITP,MCSS
http://myspeakonbi.blogspot.com/
September 9th, 2011 6:09am
Thanks,
Manoj - Lookup function is not allowing explicit conversions.
Rakesh - I have already made sure in my datasets to cast them in Varchar. But still it errors out.
For the time being i have resolved my problem by using T-SQL.
But i still want to know that why Lookup function is erroring out.
Any more ideas?
Thanks
Free Windows Admin Tool Kit Click here and download it now
September 9th, 2011 10:25am
Hi SSASStarter,
Thanks for your question and other partners’ replies. Based on my research,
source and destination expressions must evaluate to the same data type.
The return type is the same as the data type of the evaluated result expression. So please check the field of Credit’s data type.
For more detail information about lookup function, please refer to: Lookup Function (Report Builder 3.0 and SSRS)
Hope it helps you.
Thanks,
Sharp
Please remember to mark the replies as answers if they help you and unmark them if they provide no help.
September 13th, 2011 3:42am
Try this:
=Lookup(Fields!Transaction_Number.Value,Fields!TransactionNumber.Value,Fields!Credit.Value,
"Overrides")
(added ".Value" for the first 2 fields)
See sample at
http://msdn.microsoft.com/en-us/library/ee210531.aspx:
=Lookup(Fields!ProductID.Value, Fields!ID.Value, Fields!Name.Value, "Product")
Free Windows Admin Tool Kit Click here and download it now
September 15th, 2011 9:21am
Try to close project, then open it again, then write correct expression and run.
It seems like lookup failure has a "memory effect" appearing.
May 16th, 2012 4:45am