A blog (primarily about Dynamics AX/D365) covering topics like X++, AX for Retail, D365 Commerce, Trade and Logistics, retail concepts, warehousing, etc. Something for everyone. Grab bag blog for whatever I think would help out people in the Dynamics AX/Commerce/Retail community. The opinions expressed on this site are my own and do not necessarily represent the views of my company
Monday, December 28, 2009
How to prompt a user with a query window
This seems pretty straight forward but I've been asked it a few times so I'll write about it: "How can I display an interactive query window to the user in code that looks like the Advanced Query Tool?"
This can be done by taking the QueryRun value and running its method queryRun.prompt() which will return a Boolean value. If the user hits enter, the returned value will be true. If the user cancels out, the value will be false. For this reason, we would want to put this prompt in an if block:
Query query = new Query();
QueryBuildDataSource qbds;
QueryRun queryRun;
;
qbds = query.addDataSource(tableNum(CustTransOpen));
qbds.addRange(fieldNum(CustTransOpen, AccountNum));
queryRun = new QueryRun(query);
if (queryRun.prompt())
{
// Run code
}
Subscribe to:
Post Comments (Atom)
Wow! Great post! The content is very rich, and I really like it.
ReplyDeleteMicrosoft Dynamics CRM Online Training | Microsoft Dynamics AX Training