Adding parameters to RNI report options

I would like to add in the ability to print the RNI report with a filter. I can customize the print form, but how do you use the data provided (in this case VendorNum) to control the report output? It could be a single or multiple VendorNums.

Thanks!

1 Like

See the following:

For multiple values, either add multiple fields on the form, and to the RLD query (Using logic to AND /OR them, while ignoring blanks).

Or make it a text field that you enter as a comma separated list. and use the the SQL IN operator. This requires you enter the list very specifically.

" WHERE T2.CustID IN (" + T2.Character01 + ") "

And the format of the text field would need to be like:
'ACME123','WID-234'

The multiple values was what was getting me. I don’t know why, but the IN didn’t even occur to me.

Thanks!

Final screens:
image

image

***EDIT***
I had to change up the SQL a bit…

SELECT  ...
FROM    T1, T2
WHERE CASE WHEN T2.Character01 = '' THEN 1 ELSE CASE WHEN T2.Character01 LIKE '%,'+T1.VendorID+',%' THEN 1 ELSE 0 END END = 1

When I built the Character01, I used

strSelectionList = ",";
foreach (DataRowView dr in intVendorView_DataView)
{
	strSelectionList = string.Format("{0}{1},",strSelectionList, dr.Row["VendorID"]);
}

This allows for the full report when no vendors are selected.

1 Like

NIce … I didn’t realize you were trying to get the parameter from the Filter grid. That obviously took a little more work than just passing a parameter from a single text box.

It started out that way, then it kind of snowballed once it was known that it was possible. Making it work like a regular filter keeps the cheese where everybody expects it :roll_eyes:

1 Like