thcrnk
1
Hello,
I am trying to write a select when I’m using string in where clause my example is as follows:
inventDim inventDim;
str 255 a, b;
a = “WH1, WH2”;
b = strReplace(a, ", ", " || ");
while select inventDim where inventDim.InventLocationId == b
{
info(inventDim.inventDimId);
}
It is not working that way when I hard coded it like == “WH1” || “WH2” its working but I want to make it work for dynamic a string
Any sugestions?
Thank You!
After String replace, the value in b will be WH1 || WH2(without quotes) and not “WH1” || “WH2”
So what is your location ID in the table?? Is that what you are missing?
thcrnk
3
Thank you
I did it with query() like this: where warehouseParm are my Whses with ", " between them
queryBuildDataSource = query.addDataSource(TableNum(InventDim));
queryBuildRange = queryBuildDataSource.addRange(FieldNum(InventDim, InventLocationId));
queryBuildRange.value(warehouseParm);
queryRunInventDim = new QueryRun(query);
while (queryRunInventDim.next())
{
inventDim = queryRunInventDim.getNo(1);
Why don’t you simply use the following statement?
select inventDim
where inventDim.InventLocationId == 'WH1'
|| inventDim.InventLocationId == 'WH2'