SBX - Search With Button

SBX - Forum Post Title

how to fillter by dimension in Proj Invoices Table

Microsoft Dynamics AX Forum

Wael Shazly asked a question on 13 Sep 2018 5:06 AM

Question Status

Verified

how to filter the data by pass dimantion val check the following code :

ProjInvoiceJour  projInvoiceJour;
    Amount invVal;

    select sum(invoiceamount) from projInvoiceJour
    where projInvoiceJour.InvoiceDate  >= _startDate
       && projInvoiceJour.InvoiceDate  <= _endDate;
      // need to filter by dimision

    invVal = projInvoiceJour.InvoiceAmount ;

    
    return invVal;
Reply
Rustem Galiamov responded on 13 Sep 2018 5:27 AM
My Badges
Verified Answer

You should use DefaultDimensionView and related table.

As example how to use it for CustInvoiceJour and Department dimension:



CustInvoiceJour custInvoiceJour; DefaultDimensionView dimView; OMOperatingUnit operationUnit; while select custInvoiceJour join dimView where dimView.DefaultDimension == custInvoiceJour.DefaultDimension join operationUnit where operationUnit.RecId == dimView.EntityInstance && operationUnit.omOperatingUnitType == OMOperatingUnitType::OMDepartment && operationUnit.Name == departmentName { info(custInvoiceJour.InvoiceId); }



Reply
Wael Shazly responded on 13 Sep 2018 6:20 AM

Many thanks

Reply
Rustem Galiamov responded on 13 Sep 2018 5:27 AM
My Badges
Verified Answer

You should use DefaultDimensionView and related table.

As example how to use it for CustInvoiceJour and Department dimension:



CustInvoiceJour custInvoiceJour; DefaultDimensionView dimView; OMOperatingUnit operationUnit; while select custInvoiceJour join dimView where dimView.DefaultDimension == custInvoiceJour.DefaultDimension join operationUnit where operationUnit.RecId == dimView.EntityInstance && operationUnit.omOperatingUnitType == OMOperatingUnitType::OMDepartment && operationUnit.Name == departmentName { info(custInvoiceJour.InvoiceId); }



Reply

SBX - Two Col Forum

SBX - Migrated JS