Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 20764

Why does Iif check on Lookupset return #error when no matched row?

$
0
0

I have 2 Data tables based on 2 seperate Datasets  They both have the field Site_Id in them. The child dataset has field Next_Date, which I want to pull into the parent record field.

I want to match on Site_Id and return the field Next_Date from the child dataset (Called PSRC ) 

I am able to pull the correct value whenever there is a match but I cannot get rid of #error when ther is not a match.

Both Date fields are actually dates, and siteID dataTypes are the same

I have tried many iterations:  This is where I am at currently:  These 2 attempts return error when null,  Correct value when matched.  *Note, I also tried with Next date as the return value in the Iif check; I changed it to be the same as the join field in case that would work but no luck..

=Iif(Lookupset(Fields!Site_Id.Value,Fields!Site_Id.Value,Fields!Site_Id.Value,"PSRC").Length() < 1 , CDate("8/30/2019"),(Lookupset(Fields!Site_Id.Value,Fields!Site_Id.Value,Fields!Next_Date.Value,"PSRC"))(Lbound(Lookupset(Fields!Site_Id.Value,Fields!Site_Id.Value,Fields!Date.Value,"PSRC"))))

=Iif(IsNothing(Lookupset(Fields!Site_Id.Value,Fields!Site_Id.Value,Fields!Site_Id.Value,"PSRC")) , CDate("8/30/2019"),(Lookupset(Fields!Site_Id.Value,Fields!Site_Id.Value,Fields!Next_Date.Value,"PSRC"))(Lbound(Lookupset(Fields!Site_Id.Value,Fields!Site_Id.Value,Fields!Next_Date.Value,"PSRC"))))

Also,  This works based on the child data - Returns Yes or no based on getting a match

=Iif(Lookupset(Fields!Site_Id.Value,Fields!Site_Id.Value,Fields!Site_Id.Value,"PSRC").Length() < 1 , "No","Yes")

It seems as though it is error-ing when attempting to do the lookup in the ELSE whether or not the IF is true

Have I missed some way of just showing nothing when there is not a match? 

Thanks for any ideas/thoughts.



Viewing all articles
Browse latest Browse all 20764

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>