QueryRange problem

Hi All, Does someone know how to make this work by Query? ex: select salesTable where salesTable.salesId == “123” || salesTable.salesBane == “ABC”; THanks for your help

Hi Khue, I haven’t tested this. But the following should work - strFmt('((%1 == %2) || (%3 == %4))', fieldStr(SalesTable,salesID),x, fieldStr(SalesTable,salesBane), y) Hope this helps, Harish Mohanbabu

Thank you Harish. but I really trying to make it possible in Query by using query datasource and query range … When I add 2 ranges like: qSalesTable.datasourceTable(tablenum(salesTable)).addRange(fieldnum(SalesTable, salesId)).value(queryValue(“123”)); qSalesTable.datasourceTable(tablenum(salesTable)).addRange(fieldnum(SalesTable, salesName)).value(queryValue(“ABC”)); I did not work because, this make AND compound, not OR. Do you have any sugestion? This is must be an uncomfortable issue for Axapta Query if it is not possible. Thanks

Hi Khue, Apologies for not being clear. Try this - Query qr; QueryBuildDataSource qbds; QueryBuildRange qbr; ; qr = new query(); qbds = qr.addDataSource(tableNum(SalesTable)); 'Adding a dummy range qbr = qbds.addRange(fieldNum(Salestable, RecId) 'Now specify the range mentioned in my earlier post qbr.value (strFmt('((%1 == %2) || (%3 == %4))', fieldStr(SalesTable,salesID),x, fieldStr(SalesTable,salesBane), y)); Please make sure the brackets are handled properly. Addendum - also you might want to check this link - http://www.axaptapedia.com/index.php/Expressions_in_query_ranges Hope this helps, Harish Mohanbabu

Thanks Harish, I have learnt a lot.