I'm using QueryBuilder. I want to select all record in VendTable having two equal fields.
My code is looklike this:
QueryBuildDataSource qbds;
QueryRun queryRun;
qbds= queryRun.query().dataSourceTable(tableNum(VendTable));
qbds.addRange(fieldNum(VendTable, BirthDate))
.value(strFmt('%1 == %2',strFmt("%1.%2",qbds.name(), fieldStr(VendTable,BirthDate)) ,strFmt("%1.%2", qbds.name(),fieldStr(VendTable,FieldTransDate))));
On Debug I see thie query value:
SELECT * FROM VendTable(VendTable_1) WHERE ((BirthDate = {ts '1900-01-01 00:00:00.000'}))
But not work, I would like to create this query :
select vendTable
where vendTable.BirthDate== vendTable.FieldTransDate;
SELECT * FROM VendTable(VendTable_1) WHERE ((BirthDate = FieldTransDate))
I want to compare the Fields on same Table BirthDate == FieldTransDate
How I can make the query shown above by QueryBuilder ?
Thanks, enjoy!
You do not use the correct syntax for a query expression. Remember the parentheses:
qbds.addRange(fieldNum(VendTable, BirthDate))
.value(strFmt('(%1 == %2)',
strFmt("%1.%2", qbds.name(), fieldStr(VendTable, BirthDate)),
strFmt("%1.%2", qbds.name(), fieldStr(VendTable, TransDate))));