I am trying to write a select when I’m using string in where clause my example is as follows:
str 255 a, b;
a = “WH1, WH2”;
b = strReplace(a, ", ", " || ");
while select inventDim where inventDim.InventLocationId == b
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
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?
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));
queryRunInventDim = new QueryRun(query);
inventDim = queryRunInventDim.getNo(1);
Why don’t you simply use the following statement?
where inventDim.InventLocationId == 'WH1'
|| inventDim.InventLocationId == 'WH2'