Mumble
Mumble

Reputation: 141

let just one selection in query addRange AX2012

i wrote a query as follows and i want to block multiple selection for accountnum in query. Is there any way for to do this in code ?

Query = new Query();
qbdsVendTransOpen = Query.addDataSource(tableNum(VendTransOpen));
qbdsVendTrans = qbdsVendTransOpen.addDataSource(tableNum(VendTrans));
qbdsVendTrans.relations(true);
qbdsVendTrans.joinMode(JoinMode::InnerJoin);

qbdsVendTable = qbdsVendTrans.addDataSource(tableNum(VendTable));
qbdsVendTable.relations(true);
qbdsVendTable.joinMode(JoinMode::InnerJoin);

qbdsVendTable.addRange(fieldNum(VendTable,accountNum));

Upvotes: 1

Views: 503

Answers (2)

FH-Inway
FH-Inway

Reputation: 5107

I don't think this can be done easily within the query dialog. I would suggest locking the range (see @Jonathan Bravetti's answer) and building a custom dialog or field before calling the query dialog. The user would enter the account number in the custom ui and then you can use code to transfer the entered value to the query.

Upvotes: 5

Jonathan Bravetti
Jonathan Bravetti

Reputation: 2238

If you want lock your range add this line:

qbdsVendTable.addRange(fieldNum(VendTable,accountNum)).status(rangestatus::Locked);

Upvotes: 3

Related Questions