Find if value exists in Dataset
I have textboxes that work as checkboxes on my form. I have a stored procedure that brings a set of values back. I need to see if the specific values are in the dataset. If so, I put an X in the textbox if that value is in the dataset. How do
September 9th, 2015 1:38pm

Hi,

Use Lookup function  for this .

To get started follow the below link.

https://www.mssqltips.com/sqlservertip/2141/sql-server-2008-r2-reporting-services-lookup-functions/

Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 2:10pm

I can not see how this works.

So if the dataset comes back as

ID      Name

1         bob
3         jen
4         steve

So if 3 is there I want to put an X in the textbox

I was trying something like....

=iif(Lookup(Fields!Id.Value, Fields!Id.Value, Fields!Name.Value, "DataSet1")="3","X","&

September 9th, 2015 2:33pm

Hi Helixpoint, 

According to your description, you want to replace the field value if the value satisfy the condition, right? 

In your scenario, you can use IIf() function to return the required result based on the condition. Please refer to the following expression: 

Sample data: 

ID      Name

1         bob
3         jen
4         steve

Name field expression:

=IIf(Fields!Id.value = 3, "X", Fields!Name.value)

If you have ant other question, please feel free to ask. 

Regards,
Shrek Li

Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 10:51pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics