Hello All,
Martin, Thanks for your valuable time in seeing my message and replying it
I don’t think that your classDeclaration can compile, because initializing variables there is not allowed there. You can initialize them in constructor (new()).
— the above code is working in the class.
Do I understand correctly that now your requirement is to have query with OR condition using two different fields? (I don’t see such a requirement in your original question, therefore it’s not covered by my previous answer.).
Yes you have understood it properly. query with OR condition using two different fields and the resulting answers of the query should be displayed on the grid ( The query is working fine in the class but when try to replicate the same code on execute query of the table)
The code snippet is here :
Form has a grid which displays all year accounts with cost and this needs to be filtered for Year2014 and cost 0.00
Form > Datasources> CostTable>ExecuteQuery
public void executeQuery()
{
Query q; QueryRun qr; QueryBuildDataSource qbr1;(For reference purposes)
q = new Query(); // Create a new query.
qbr1 = q.addDataSource(tablenum(CostTable));
qbr1.name(“CostingTable”);
qbr1.addRange(fieldNum(CostTable,AcctName)).value(
strFmt(’((%1.%2 == “Year2014”) || (%1.%2 == “0.00”))’,
qbr1.name(),
fieldStr(CostTable,AcctName),
fieldStr(CostTable,Cost)));
qr = new QueryRun(q);
super();
}
An alternative solution would be using a separate query for each condition combined to a single union query.
Martin, it would be great if you can provide a sample snippet of what you trying to tell.
Thanks all in adavnce
Regards
Shankar Iyer