Create the following command in a separate report. Create a string parameter within the command and do NOT set it up for multiple values. Add the Inventory.Stock field to the detail section of the report.
SELECT Inventory.Warehouse, Inventory.Stock
FROM SQLUser.Inventory Inventory
INNER JOIN SQLUser.CompanyInfo CompanyInfo ON
Inventory.Warehouse=CustInfo.Warehouse
WHERE Inventory.Warehouse=134 and
Inventory.Stock in ({?StockNum})
ORDER BY Inventory.Stock
Add a formula {@in db} to the detail section and suppress it:
whileprintingrecords;
stringvar y;
numbervar i;
for i := 1 to ubound(split({?StockNum},",")) do (
if
(
totext({Command.Stock},0,"") = split({?StockNum},',') and
not(totext({Command.Stock},0,"")in y)
) then
y := y + totext({Command.Stock},0,"")+","
);
y
Add a formula {@not in db} to the report footer of the subreport:
whileprintingrecords;
stringvar y;
stringvar x;
numbervar i;
for i := 1 to ubound(split({?StockNum},",")) do(
if not(split({?StockNum},",") in y) and
not(split({?StockNum},",") in x) then
x := x + split({?StockNum},",")+","
);
if len(x)>1 then
"Not Found in Database:" +" "+
left(x,len(x)-1) else
"Not Found in Database:" +" "+x;
Then save the report and insert it as a subreport in the report header of your original report. Link the subreport as explained before, using the dropdown to select {?StockNum} as a linking field. If the warehouse number is a parameter in your main report, create the same parameter within the command and replace 134 with that. If it is a string parameter, put single quotes around the parameter like this '{?Warehouse}', but do NOT do this for {?StockNum} because you are entering an array, not one value. Then also link the subreport on the warehouse parameter, again using the dropdown.
Using the subreport allows you to display selected parameter values and the alert about values in the report header of your main report.
-LB