1.create a method in a class
str fieldListRange(FieldName _fieldName, str _value)
{
container c;
int countNumber;
str rangeValue;
A_InventImport A_InventImport ;
;
while select * from A_InventImport
{
// c = conins(c,A_InventImport .itemid);
c+= A_InventImport .ItemId;
}
for (countNumber = 1; countNumber <= conLen(c); countNumber++)
{
if(rangeValue)
{
rangeValue +="||";
}
rangeValue +="(" + _fieldName + " = \"" + strLRTrim(any2str(conPeek(c, countNumber))) + "\")";
}
return rangeValue;
}
then call this method in run method
queryRun.query().dataSourceTable(tablenum(inventsum)).addRange(fieldnum(inventsum,Closed)).value(queryvalue(noyes::Yes));
queryRun.query().dataSourceTable(tablenum(inventsum)).addRange(fieldnum(inventsum,itemid)).value((strFmt("(%1) || (%2 = %3)",
this.fieldListRange(fieldStr(A_InventImport , ItemId), parameter1),
fieldStr(A_InventImport , ItemId), SysQuery::valueEmptyString())));
declare parameter1 as a string in the run method.
str fieldListRange(FieldName _fieldName, str _value)
{
container c;
int countNumber;
str rangeValue;
A_InventImport A_InventImport ;
;
while select * from A_InventImport
{
// c = conins(c,A_InventImport .itemid);
c+= A_InventImport .ItemId;
}
for (countNumber = 1; countNumber <= conLen(c); countNumber++)
{
if(rangeValue)
{
rangeValue +="||";
}
rangeValue +="(" + _fieldName + " = \"" + strLRTrim(any2str(conPeek(c, countNumber))) + "\")";
}
return rangeValue;
}
then call this method in run method
queryRun.query().dataSourceTable(tablenum(inventsum)).addRange(fieldnum(inventsum,Closed)).value(queryvalue(noyes::Yes));
queryRun.query().dataSourceTable(tablenum(inventsum)).addRange(fieldnum(inventsum,itemid)).value((strFmt("(%1) || (%2 = %3)",
this.fieldListRange(fieldStr(A_InventImport , ItemId), parameter1),
fieldStr(A_InventImport , ItemId), SysQuery::valueEmptyString())));
declare parameter1 as a string in the run method.