Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

Validating/Filtering AOT Query from MorphX Report Dynamically

$
0
0

Hi Experts

How to Validate a AOT query dynamically in Morphx Report(AOT Report).I want to Give a error message and stop report execution when certain type of records is found in a report

Example Code:

public boolean fetch()
{
    boolean retCode = false;
    BankAccountTable bankAccountTableRec;
    QueryRun qrun;
    ;
    // Use the queryRun object that is associated with the
    // report; element refers to the report.
    qrun = new QueryRun(element);

    // Verify that the report dialog works.
    if (! qrun.prompt())
    {
        return retCode;
    }

    // Loop through each record from the data source query of the report.
    while (qrun.next())
    {
        // Get the BankAccountTable fields from the query record.
        bankAccountTableRec = qrun.get(TableNum(BankAccountTable));

        // Exclude ODDBANK from the visible report.
        if (bankAccountTableRec.AccountID != "ODDBANK")
            {
                // Include the current record in the report.
                element.send(bankAccountTableRec);
            }
    }
    retCode = true;

    // retCode = super(); // Do not call super() when you override the fetch method.
    return retCode;
}

https://msdn.microsoft.com/en-us/library/bb395110(v=ax.50).aspx




I can use the above code but i don't think that's optimal way because
looping whole query to find one Invalid Record and stopping a report execution seems wrong...



Is there any other way to approach this problem?




Viewing all articles
Browse latest Browse all 72043

Trending Articles