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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

parmQuery() join

(1) ShareShare
ReportReport
Posted on by 497

i have source code as this below :

public void processReport()
{
    MK_AgingAPReportContract    contract = this.parmDataContract();
    VendTable       vendTable;
    VendTrans       vendTrans;
    DimensionAttributeValueCombination dimensionAttributeValueCombination;

    QueryRun        qr = new QueryRun(this.parmQuery());
qr.query().dataSourceTable(tableNum(VendTrans)).addRange(fieldNum(VendTrans,TransDate)).value(SysQuery::range(dateNull(),contract.parmAsOfDate());

    while (qr.next())
    {

        vendTrans = qr.get(tableNum(VendTrans));

        tmpAgingAP.InvoiceDate              = vendTrans.TransDate;
        tmpAgingAP.InvoiceId                = vendTrans.Invoice;
        tmpAgingAP.AmountMST                = vendTrans.AmountMST;
        tmpAgingAP.DueDate                  = vendTrans.DueDate;
        tmpAgingAP.BeforeDueDate            = (vendTrans.DueDate >= contract.parmAsOfDate()) ? vendTrans.AmountMST : 0;
        tmpAgingAP.AfterDueDate             = (vendTrans.DueDate >= contract.parmAsOfDate()) ? 0 : vendTrans.AmountMST;
        tmpAgingAP.Days                     = (contract.parmAsOfDate() > vendTrans.DueDate) ? contract.parmAsOfDate() - vendTrans.DueDate : 0;
        tmpAgingAP.VendAccount              = vendTrans.AccountNum;
        tmpAgingAP.Name                     = vendTrans.vendTableName();
        tmpAgingAP.Currency                 = vendTrans.CurrencyCode;
        tmpAgingAP.Description              = vendTrans.vendInvoiceJour_RU().Description;
        tmpAgingAP.PaymTermId               = vendTrans.vendTablePaymTermID();
        tmpAgingAP.AmountCur                = vendTrans.AmountCur;
        tmpAgingAP.SummaryLedgerDimension   = vendTrans.vendLedegrAccounts_SLD().SummaryLedgerDimension;
        tmpAgingAP.DisplayValue             = vendTrans.getDisplayValue(tmpAgingAP.SummaryLedgerDimension);
        tmpAgingAP.VendGroup                = vendTrans.getVendGroup();
        tmpAgingAp.LessThan30               = ((tmpAgingAp.Days >= 1) && (tmpAgingAp.Days < 30)) ? tmpAgingAp.AmountMST : 0;
        tmpAgingAp.Between3060              = ((tmpAgingAp.Days >= 30) && (tmpAgingAp.Days < 60)) ? tmpAgingAp.AmountMST : 0;
        tmpAgingAp.Between6090              = ((tmpAgingAp.Days >= 60) && (tmpAgingAp.Days < 90)) ? tmpAgingAp.AmountMST : 0;
        tmpAgingAp.Over90                   = (tmpAgingAp.Days >= 90) ? tmpAgingAp.AmountMST : 0;

        tmpAgingAP.insert();

    }


}

and then how add addRange() to get DisplayValues field values in DimensionAttributeValueCombination table?

this is relation it :

VendTable ->AccountNum <- VendTrans

VendTrans ->PostingProfile<-VendLedgerAccounts

VendTable ->VendGroup<-->Num<-VendLedgerAccounts

VendLedegrAccounts ->SummaryLedgerDimension<-->RecId<-DimensionAttributeValueCombination

Can help me please friends?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Brandon Wiese Profile Picture
    17,788 on at
    RE: parmQuery() join

    It's not clear, but it looks from your code like all you want is the DisplayValue field from the DimensionAttributeValueCombination record.  I see you're using a vendTrans.getDisplayValue(ledgerDimension) method which doesn't exist out of the box.

    All you really have to do is

    tmpAgingAP.DisplayValue = DimensionAttributeValueCombination::find(tmpAgingAP.SummaryLedgerDimension).DisplayValue;


  • Luan Nguyen Profile Picture
    689 on at
    RE: parmQuery() join

    Did you create a Query, cause I saw this code "this.parmQuery()",

    For easy way, If you created it,you just add field DisplayValue field from DimensionAttributeValueCombination Table to Range in your Query.

  • murtafiah Profile Picture
    497 on at
    RE: parmQuery() join

    not meaning it, i am displaying DisplayValue field with code tmpAgingAP.DisplayValue             = vendTrans.getDisplayValue(tmpAgingAP.SummaryLedgerDimension); and work well..

    but, i mean add parmQuery() to DisplayValue field as qr.query().dataSourceTable(tableNum(VendTrans)).addRange(fieldNum(VendTrans,TransDate)).value(SysQuery::range(dateNull(),contract.parmAsOfDate());..

    althought i have contract.parmDisplayValue().. so i have parameter input DisplayValue field before user click view report..

    How?

    Do you meaning it?

  • Brandon Wiese Profile Picture
    17,788 on at
    RE: parmQuery() join

    As easier solution might be to do an if statement against DisplayValue, and compare it to the contract value, and only create and insert your tmpAgingAP record when they are the same.

  • murtafiah Profile Picture
    497 on at
    RE: parmQuery() join

    Mr. Nguyen Luan

    Yes query, for more details how to create a parameter with DisplayValue field from DimensionAttributeValueCombination table. That parameter to use as input user before user click View Report event..

    while i have source code parmDisplayValue() in class MK_AgingAPReportContract as this below :

    [DataMemberAttribute("DimensionDisplayValue"), SysOperationDisplayOrderAttribute("1")]

    public DimensionDisplayValue parmDisplayValue(DimensionDisplayValue _displayValue = displayValue)

    {

       displayValue = _displayValue;

       return displayValue;

    }

    and before i also declare

    DimensionDisplayValue displayValue; in classDeclaration MK_AgingAPReportContract..

    How?

  • murtafiah Profile Picture
    497 on at
    RE: parmQuery() join

    Mr. Brandon

    i am not understand with your answer..

  • Luan Nguyen Profile Picture
    689 on at
    RE: parmQuery() join

    it's still not clear, please tell us what exactly what you want ?

    With this situation, you just create query with DimensionAttributeValueCombination table, after that add range with parmDisplayValue.

  • murtafiah Profile Picture
    497 on at
    RE: parmQuery() join

    Mr. Nguyen Luan

    Sorry i am wrong of make a question..

    i mean, how to create a parameter to inputting by user in Manajemen Report AXAPTA Production (WEB)?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

#2
NNaumenko Profile Picture

NNaumenko 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans