web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

How to get the value from SysQueryForm's Criteria and Field fields

(0) ShareShare
ReportReport
Posted on by 147
Hi all experts,
 
I have a customized form that called the SysQueryForm before initializing it to filter the result shown on the form. I have the following code, 
 
void EInvoice_SysQueryForm()
{
    SysQueryRun sysQueryRun = new SysQueryRun(ads_EInvoiceTable_ds.query());
    if(!sysQueryRun.prompt())
    {
        element.close();
    }
    Query query = sysQueryRun.query();
    QueryBuildDataSource qbds = query.dataSourceTable(tableNum(ads_EInvoiceTable));
    QueryBuildRange range = SysQuery::findOrCreateRange(qbds, fieldNum(ads_EInvoiceTable, ads_SubmissionStatus));
    
    if(!range.value())
    {
        range.value(SysQuery::value(ads_SubmissionStatus::Draft));
    }
    else
    {
        range.value(SysQuery::value(ads_SubmissionStatus::Submitted));
    }
    ads_EInvoiceTable_ds.query(query);
    ads_EInvoiceTable_ds.queryRun();
}
 
public void init()
 {
     super();
     _contract=element.args().parmObject() as ADS_MYeInvoiceDataContractWS;
     if (_contract==null)
     {
         element.EInvoice_SysQueryForm();
     }
     else
     {
         _parmFromDate = _contract.parmFromDate();
         _parmToDate = _contract.parmToDate();
         _status=_contract.parmStatus();
         qbr=ads_EInvoiceTable_ds.queryBuildDataSource().addRange(fieldNum(ads_EInvoiceTable,ads_SubmissionStatus));
         qbr.value(queryValue(_status));
         //qbr1=CustInvoiceJour_ds.queryBuildDataSource().addRange(fieldNum(CustInvoiceJour,InvoiceDate));
         //qbr1.value(SysQuery::range(_parmFromDate,_parmToDate));
         qbr1=ads_EInvoiceTable_ds.queryBuildDataSource().addRange(fieldNum(ads_EInvoiceTable,ads_InvoiceDate));
         qbr1.value(SysQuery::range(_parmFromDate,_parmToDate));
         ads_EInvoiceTable_ds.executeQuery();
         //CustInvoiceJour_ds.executeQuery();
     }
     
 }
 
I would like to do if I have other value on the SysQueryForm, for example, /Submitted/, then the form will showed the /Submitted/ records, not a blank form.
//////
//////
 
Hence, I would like to ask how can I code to get the criteria value from the SysQueryForm.
 
Best regards,
Yue Zhen
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
SajeedMullaji Profile Picture

SajeedMullaji 760

#2
Martin Dráb Profile Picture

Martin Dráb 330 Most Valuable Professional

#3
CU10121822-0 Profile Picture

CU10121822-0 310

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans