Friday, 28 September 2018

Format Date Time On SSRS Report

On SSRS server, format standart for DateTime was adapted from Computer Setting. If we want to change this format, we must use an expression Format(Date, "StringFormat") like picture below


2) The Format command and specify the exact format you require.
For example…
CommandResult
Format(Parameters!Date.Value,”dd-MM-yyyy”)10-04-2007
Format(Parameters!Date.Value,”dd/MM/yyyy”)10/04/2007
Format(Parameters!Date.Value,”MMM-dd-yyyy”)Apr-10-2007
Format(Parameters!Date.Value,”MMM-dd-yy”)Apr-10-07
So 3 M’s give you “Apr” ….anyway this is quite useful if you’re looking for Day/Month/Year , since the system will default to MM/DD/YYYY.

Reference : https://thavash.wordpress.com/2007/04/10/working-with-dates-in-reporting-services/

Sunday, 9 September 2018

Extensible Inventory Dimensions


The below post describes the changes in more detail.

https://blogs.msdn.microsoft.com/mfp/2017/08/10/extensible-inventory-dimensions/

I believe we can workaround the field name by using unique class and method names as shown in the example. 

Currently we have 15 dimensions in standard and MS is adding 10 more fields bringing the total to 25. In future, MS has scope to add 7 more dimensions as there is a limitation now to work only with 32 dimensions because the InventDimFixed edit is a 32 bit type.

The real development work will be when you need to merge dimension changes from more than 2 ISVs.

This solution from MS can't be considered a complete solution unless we get rid of the macros used in the select statements and bring in a better way of extending those select statements, probably using the query framework and extensions for framework.

Wednesday, 5 September 2018

how to extend the DP class methods in D365


[ExtensionOf(ClassStr(PurchPurchaseOrderDP))]
final class PurchPurchaseOrderDP_Extension
{
   
    private void new()
    {
    }
 Protected PurchPurchaseOrderTmp initializeOrderLine(
        PurchPurchaseOrderHeader                    _purchaseOrderHeader,
        boolean                                     _highlightUpdated,
        PurchPurchaseOrderDPOrderLineQuerySelection _orderLineSelection)
    {

        PurchPurchaseOrderTmp purchPurchaseOrderTmp = next initializeOrderLine(_purchaseOrderHeader,
                                                                               _highlightUpdated,
                                                                               _orderLineSelection);

        if (purchPurchaseOrderTmp.PurchOrderTransOrTaxTrans)
        {
            //purchPurchaseOrderTmp.TRI_LineIsTaxed = this.TRILineIsTaxed(purchLine.RecId);
            purchPurchaseOrderTmp.TRI_LineIsTaxed = this.TRILineIsTaxed(PurchLine::findInventTransId(_orderLineSelection.parmPurchLineAllVersions().InventTransId).RecId, purchPurchaseOrderTmp);
        }
        //purchPurchaseOrderTmp.TRI_AGLRevision   = PurchLine::findRecId(purchline.RecId).TRI_AGLRevision;
        purchPurchaseOrderTmp.TRI_AGLRevision   = PurchLine::findRecId(PurchLine::findInventTransId(_orderLineSelection.parmPurchLineAllVersions().InventTransId).RecId).TRI_AGLRevision;

        return purchPurchaseOrderTmp;

    }

    /// <summary>
    ///  Set boolean if line is taxed
    /// </summary>
    /// <param name = "_purchLineRecId">RecId for purchLine</param>
    /// <returns>Returns true if line is taxed</returns>
    protected boolean TRILineIsTaxed(RefRecId _purchLineRecId, PurchPurchaseOrderTmp _purchPurchaseOrderTmp)
    {
        boolean                 lineIsTaxed;
        PurchTotals             tri_PurchTotals;
        TaxPurch                taxPurch;
        AmountCur               taxAmountCurTotal;
        AmountCur               taxRegulationTotalCur;
        ;

        tri_PurchTotals = PurchTotals::newPurchTable(VendPurchOrderJour::findRecId(_purchPurchaseOrderTmp.JournalRecId).purchTable());
        tri_PurchTotals.calc();
        taxPurch = tri_PurchTotals.tax();

        if (tri_PurchTotals && _purchLineRecId)
        {
            [taxAmountCurTotal, taxRegulationTotalCur] = taxPurch.showTaxesSourceSingleLine(tableNum(PurchLine), _purchLineRecId, true);
            lineIsTaxed = taxAmountCurTotal != 0.00;
        }

        return lineIsTaxed;
    }

}

Friday, 17 August 2018

How to Use AX Form As lookup in Dynamics Ax 2012

Consider a scenario where, I required a StringEditControl and Clicking on Control a lookup is open where the list of Customer of selected Legal Entity are available. And After Selecting required Customer, Customer Id Or AccountNum is return form Lookup form.

For This purpose we have to create form, which will used as look Up.

Create a New form. Name It  “FormCustomerLookUp”
New Form
In Data Source Create and New dataSource Name It CustomerTable and Point to CustTable.

Customer Table As DataSource
Expand the Design node  and Right Click on It and Add Grid, Now from CustomerTable Data Source, Drag and drop “AccountNum” and “Party” on Grid. It will create two String Edit Control on Grid bound with CustomerTable.

CustomerFields
Now Select on “StringEdit:CustomerTable_AccountNum” select Properties. Form Properties window Set Its Auto declaration  property to True.

LookUpFieldAutoProperties
Now expend the Methods Node form and Right click and override the Init method from there and add following line of code there.

    element.selectMode(CustomerTable_AccountNum);

LookUpFormInitialization


Now right click on Design Node and Update following properties.
Width=360
Style=LookUP.
StyleToLookUp



Now Create a form where this lookup will use. For this Article I have to create very simple form with only on stringEdit textbox.
On its Design Right click and create StringEditButton with Name “LookUpTest” and from Its property window Auto Declare Property is set to Yes and lookupButton property to “Always”.

TargetFieldProperties

LookUpFields

Monday, 13 August 2018

Modify PrintMgmt Report format table

/// <summary>
/// Allows for the population of the PrintMgmtReportFormat table used for print management.
/// </summary>
/// <remarks>
/// This is a framework class. Customizing this class may cause problems with future upgrades to the software.
/// </remarks>
class CITPrintMgmtReportFormatSubscriber
{
    /// <summary>
    /// Event handler for populating the PrintMgmtReportFormat table.
    /// </summary>
    [SubscribesTo(classstr(PrintMgmtReportFormatPublisher), delegatestr(PrintMgmtReportFormatPublisher, notifyPopulate))]
    public static void notifyPopulate()
    {
        UMAPrintMgmtReportFormatSubscriber::populate();
    }

    /// <summary>
    /// Adds records to the <c>PrintMgmtReportFormat</c> table.
    /// </summary>
    /// <remarks>
    /// New report formats are manually added in this method by a developer.  The method is called before
    /// the <c>PrintMgmtSetupUIMain</c> form opens to ensure the list of available reports is updated.
    /// </remarks>
    public static void populate()
    {
        #PrintMgmtSetup
        #ISOCountryRegionCodes
        int reports = 0;
        int added = 0;
        LogisticsAddressCountryRegionISOCode isoCountryCode = SysCountryRegionCode::countryInfo();
        LogisticsAddressCountryRegionId countryRegionId = SysCountryRegionCode::getCountryRegionIdByIsoCode(isoCountryCode);
        #RusReportFormats


        ttsbegin;
       
       
        UMAPrintMgmtReportFormatSubscriber::add(PrintMgmtDocumentType::SalesOrderPackingSlip, ssrsReportStr(UmaPackingSlip, Wayfair), ssrsReportStr(UmaPackingSlip, Wayfair), countryRegionId, NoYes::Yes, PrintMgmtSSRS::SSRS);
        UMAPrintMgmtReportFormatSubscriber::add(PrintMgmtDocumentType::SalesOrderPackingSlip, ssrsReportStr(UmaPackingSlip, Amazon), ssrsReportStr(UmaPackingSlip, Amazon), countryRegionId, NoYes::Yes, PrintMgmtSSRS::SSRS);

        ttscommit;
    }

    private static boolean add(
            PrintMgmtDocumentType _type,
            PrintMgmtReportFormatName _name,
            PrintMgmtReportFormatDescription _description,
            PrintMgmtReportFormatCountryRegionId _countryRegionId,
            PrintMgmtReportFormatSystem _system
            , PrintMgmtSSRS _ssrs = PrintMgmtSSRS::SSRS
            )
    {
        PrintMgmtReportFormat printMgmtReportFormat;
        boolean isDuplicateFound;
        boolean isSystemFormatWithDifferentDescriptionFound;

        #PrintMgmtSetup

        isSystemFormatWithDifferentDescriptionFound = _system && (select firstOnly RecId from printMgmtReportFormat
            where printMgmtReportFormat.DocumentType == _type
                && printMgmtReportFormat.Description != _description
                && printMgmtReportFormat.System == true).RecId != 0;

        // If the format no longer matches up with the existing system formats, change them all to
        // non-system formats. This ensure existing links / setup will not be broken, but also provides
        // a way for the user to fix the formats.
        if (isSystemFormatWithDifferentDescriptionFound)
        {
            update_recordSet printMgmtReportFormat
                setting System = false
                where printMgmtReportFormat.DocumentType == _type
                    && printMgmtReportFormat.Description != _description
                    && printMgmtReportFormat.System == true;
        }

        isDuplicateFound = (select RecId from printMgmtReportFormat
            where printMgmtReportFormat.DocumentType == _type
                && printMgmtReportFormat.Description == _description
                && printMgmtReportFormat.CountryRegionId == _countryRegionId).RecId != 0;

        if (isDuplicateFound)
        {
            if (isSystemFormatWithDifferentDescriptionFound)
            {
                // We must ensure that the system report always matches the country context
                // of the company. If the the country context has been chagned multiple times
                // such that the report format already exists, we must change it back to system.
                update_recordSet printMgmtReportFormat
                    setting System = true
                    where printMgmtReportFormat.DocumentType == _type
                        && printMgmtReportFormat.Description == _description
                        && printMgmtReportFormat.CountryRegionId == _countryRegionId;
            }
            else
            {
                return false;
            }
        }
        else
        {
            // Add the new format
            printMgmtReportFormat.clear();
            printMgmtReportFormat.DocumentType = _type;
            printMgmtReportFormat.Name = _name;
            printMgmtReportFormat.Description = _description;
            printMgmtReportFormat.CountryRegionId = _countryRegionId;
            printMgmtReportFormat.System = _system;
            printMgmtReportFormat.ssrs = _ssrs;
            printMgmtReportFormat.insert();
        }

        return true;
    }

}

D365 Extending Reports

https://blogs.msdn.microsoft.com/dynamicsaxbi/2017/01/02/customizing-app-suite-reports-using-extensions/

https://stoneridgesoftware.com/customizing-the-check-report-via-extensions-in-dynamics-365-for-operations/


https://blogs.msdn.microsoft.com/dynamicsaxbi/2017/01/01/how-to-custom-designs-for-business-docs/

Wednesday, 18 July 2018

Large and strange font sizes in menus for Dynamics AX 2012 on remote sessions

Large and strange font sizes in menus for Dynamics AX 2012 on remote sessions

February 14, 2018 at 13:13
filed under Dynamics AX
Tagged 
Hi all!
When you open a Dynamics AX 2012 client (RTM/FP/R2/R3) on a remote session it sometimes looks pretty weird. Font sizes are all over the place and overall it doesn’t look that great. See for example in the following screenshot:
You can get better results by changing the properties of the shortcut if you check the checkbox Disable display scaling on high DPI settings on the Compatibility tab.

The result is better but still not entirely accurate:

You can get the best results by changing the display settings on you host system (so the PC or laptop you are working on). I have Windows 8.1 but you should find a similar setting on other versions of Windows in the Display section of the Control panel.
Microsoft recommends 125% scaling by default, but I prefer to set it at 100%. Setting it to 100% will also give you the best results for Dynamics AX 2012 in remote sessions. So, on your system, change the setting to 100% as seen in the following screenshot.

This property will only be active after you sing off and sign in again, so do that also.
If you connect to a remote session now, you will see that the scaling of the text in Dynamics AX 2012 is now accurate. This will improve your experience and your screenshots.