Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Printing new filter range added to dynamic parameters to RDP

Posted on by 570

Hello..

how i can print the new filter rang that added to dynamic parameters  after dialog open 

http://dev.goshoom.net/en/2014/09/showing-dynamic-parameters/

the previous article print the default parameters with out the new filter range that added to dialog

i found a comment in this article talking  about it but i didn't understand it

the comment

Everything works fine with query and it’s predifiend ranges. But it does not catch new range fields and values added in prompt dialog.
static void Job155(Args _args)
{
Query q = new Query();
QueryBuildDataSource qbds;
TmpSysQuery tmpsysquery;
QueryRun qr;
;

qbds = q.addDataSource(tableNum(CustTable));
qbds.addRange(fieldNum(CustTable, AccountNum)).value(“d*”);
qbds.addRange(fieldNum(CustTable, custgroup)).value(“c*”);

qr = new QueryRun( q);

if( !qr.prompt()) // apply new range fields and values
return;

tmpsysquery = MyQueryUtils::rangesToTable( qr.query()); // previously provided method

while select tmpsysquery
{
info( strFmt(“%1.%2 == %3”, tmpsysquery.Tablelabel, tmpsysquery.FieldLabel, tmpsysquery.RangeValue));
}
// prints the following
/*
Customers.customer == d*
customers.customer group == c*
*/

}


thank you

  

*This post is locked for comments

  • Verified answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: Printing new filter range added to dynamic parameters to RDP

    Hi, Ismail!

    This is because AccountNum and CustGroup - ranges and rangesToTable(qr.query()) get it, but a new fields and values added in prompt dialog - it is filters.

    To get query filters you should use queryFilter() method (query.queryFilter()) in rangesToTable() method:

    public static TmpSysQuery rangesToTable(Query _query)
    {

    QueryBuildDataSource qbds;
    QueryBuildRange queryBuildRange;
    TmpSysQuery tmpSysQuery;
    LabelType tableLabel;
    int occurrence;
    int dataSourceNo;
    int i;
    int y;
    QueryFilter queryFilter;

    if (!_query)
    {
          return tmpSysQuery;
    }

    for (dataSourceNo = 1; dataSourceNo <= _query.dataSourceCount(); dataSourceNo++)
    {
         qbds = _query.dataSourceNo(dataSourceNo);
         if (qbds.enabled())
        {
               occurrence = SysQuery::tableOccurrence(_query, qbds.table(), dataSourceNo);

    tableLabel = tableId2pname(qbds.table()) + SysQuery::tableOccurrenceText(occurrence);

    for (i = 1; i <= qbds.rangeCount(); i++)
    {

    queryBuildRange = qbds.range(i);

    if (queryBuildRange.value() && queryBuildRange.status() != RangeStatus::Hidden)
    {

    tmpSysQuery.clear();
    tmpSysQuery.DataSourceNo = qbds.uniqueId();
    tmpSysQuery.TableLabel = tableLabel;
    tmpSysQuery.FieldLabel = fieldId2pname(qbds.table(), queryBuildRange.field());
    tmpSysQuery.RangeValue = queryBuildRange.value();
    tmpSysQuery.insert();

    }

    }

    for (y = 1; y <= _query.queryFilterCount(); y++)
    {

    queryFilter = _query.queryFilter(y);

    if (queryFilter.value() && queryFilter.status() != RangeStatus::Hidden)
    {

    tmpSysQuery.clear();
    tmpSysQuery.DataSourceNo = qbds.uniqueId();
    tmpSysQuery.TableLabel = tableLabel;
    tmpSysQuery.FieldLabel = queryFilter.field();
    tmpSysQuery.RangeValue = queryFilter.value();
    tmpSysQuery.insert();

    }

    }

    }

    }

    return tmpSysQuery;


    }

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans