How to use like and * operator in dynamic query
GirishS
27,832
Super User 2024 Season 1
Hi,
In this blog we will see how to use like and * operator in dynamic query.
qbr2.value(strFmt('((%1 like "%2") || (%3 = %4))', fieldStr(HcmWorker,PersonnelNumber),queryvalue('00005*'), fieldStr(HcmWorker,WorkerStatus),HcmWorkerStatus::Employee 0));
You can also use SysQuery class to use the like operator.
qbr = qbds.addRange(fieldnum(HcmWorker, PersonnelNumber)); qbr.value(SysQuery::valueLike(queryValue('00005')));
In the above code we are adding 0 to the Enum value, this makes STRFMT to use numeric value for Enum instead of names.
Output will be ((PersonnelNumber like "00005*") || (Status = 0))
Thanks.
*This post is locked for comments