Skip to main content

Posts

Showing posts from April, 2024

Total Amount of Purchase Order in X++

Method 1:  public AmountCur totalAmount()        // PurchLine       purchLine;         AmountCur       amountCur = 0;         while select crosscompany purchLine             index hint PurchLineIdx             where purchLine.PurchId         == purchtables.PurchId               && !purchLine.IsDeleted         {            // amountCur += purchLine.calcLineAmountExclTax(purchLine.PurchQty );                             amountCur += purchLine.calcLineAmount(purchLine.PurchQty + purchLine.ConfirmedTaxAmount );                          }         return amo...

Change Company

change company helps to chnage the value of our field on the mark of the entity value  suppose you are overding a value in 3005 when you change to 1005 and click button the value changes in 1005 too   class LegalEntityRestriction_FYCDeleteExistingEntries     {         /// <summary>         ///         /// </summary>         /// <returns></returns>         public boolean modified()         {             boolean ret;                      //ret = super();             LedgerParameters ledgerparameter;                  ret = super();             if(LegalEntityRestriction_FYCDeleteExistingEntries.valueStr( ) == enum2Str(NoYes::Yes))   ...

CrossCompany method

 CrossCompany method is used for getting cumulative data from all entities across our project  Example For Cross company  Note: While select is compulsory so we can run loop   public AmountCur totalAmount()        // PurchLine       purchLine;         AmountCur       amountCur = 0;         while select crosscompany purchLine             index hint PurchLineIdx             where purchLine.PurchId         == purchtables.PurchId               && !purchLine.IsDeleted         {            // amountCur += purchLine.calcLineAmountExclTax(purchLine.PurchQty );                             amountCur += purchLine.calcLineAmoun...

Ui Builder Class

Below code is example for UI Builder Class   final class ReportGSTForSettlementPeriodReportUiBuilder  extends SrsReportDataContractUIBuilder {         DialogField                            EntityIdField;//SubProjIdField;     TaxReportInclAdjustmentContractCopy               contract;         //ProjTable                              projtable;         TaxReportInclAdjustmentTmpCopy  taxReportInclAdjustmentTmpCopy;         public void Postbuild()         {             super();             //get reference to custAccount dialog field         EntityIdField = this.bindInfo().getDialogField(this.dataContr...

SSRS Syntax for RDP and Contract Class

  1- -------------------------  Create a contract class   Report_NameContractClass------------------------------ [DataContractAttribute]  class *Report_Name*ContractClass {    //Defining variables for report parameter.  *EDT of parameter field*  *Field_reference*;      //Defines parameter properties. [ DataMemberAttribute('*Parameter_Field_name*') SysOperationLabelAttribute(literalStr("@SYS190134")), SysOperationLabelAttribute (“label”), SysOperationHelpTextAttribute(“help text”), SysOperationDisplayOrderAttribute(“1”) ]     //Returns parameter value if found. public *EDT of parameter field*   Parm*Parameter_Field_name*(*EDT of parameter field*             _*Field_reference*=*Field_reference*)    {          *Field_reference* = _*Field_reference*;    return *Field_reference*;    }  ...

How to get rid of blank pages in PDF exported from SSRS

  How to get rid of blank pages in PDF exported from SSRS Click on Report > Report Properties > Layout tab (Page Setup tab in SSDT-BI) https://stackoverflow.com/questions/362902/how-to-get-rid-of-blank-pages-in-pdf-exported-from-ssrs

How to write lookup for selecting multiple options

Before Writing code we have to create string in form Right click on group and now go to string add Name it diffrent or we can add lable later create lookup method override First set the ReplaceOnLookup property of the control to “NO” Second set the control Autodeclartion property to “Yes” [Control("String")]     class FormStringControl1     {         /// <summary>         ///         /// </summary>         public void lookup()         {             SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(Food), this);             Query query = new Query();             QueryBuildDataSource qbds;                          sysTableLookup.addLookupField(fieldnum(Food,FoodName  ), true); ...

Number Of Records Left in Data Source

This code is used to get Info of how many records left in Record  Example after deleting how number records left in that Data source or After Adding records how many are there in the datasource  public void init() {     QueryRun queryRun;     super();     queryRun = new QueryRun(Student_ds.query());     info(strfmt("Total Records in Student Datasource %1",SysQuery::countTotal(queryRun))); }

Split Method in X++

Split method is used to split value of a Name or Number using a decimal or comma so that we can separate them and use in fields in report or in form   public static void main (Args args)     {         str _Value,beforeDec,afterDec;         int x;         str str1='Jake,Grey';         Names names;          List strlist=new List(Types::String);         ListIterator iterator;           strlist=strSplit(str1,',');         iterator = new ListIterator(strlist);         while(iterator.more())         {             x= x+1;             if(x==1)             {                 beforeDec =iterator.value();           ...

Basic SSRS Expressions

Basic SSRS Expressions  1.To add current date and time in report use the follwing code now =Format(Now(), "MM/dd/yyyy hh:mm tt") 2.To add total number of pages after the page number use the following code now ="Page "&Globals!PageNumber &" of "&Globals!TotalPages 3.To print date: Format(Now, "dd/MM/yyyy") 4.To print time: Format(Now, "hh:mm tt") 5.To print datetime use the following code: =Format(Now, "dd/MM/yyyy") & vbCrLf & Format(Now, "hh:mm tt") 6.To print time depends on different time zones use the following code: =Microsoft.Dynamics.Framework.Reports.DataMethodUtility.ConvertUtcToAxUserTimeZoneForUser(Parameters!AX_CompanyName.Value, Parameters!AX_UserContext.Value, System.DateTime.UtcNow, "d", Parameters!AX_RenderingCulture.Value) & vbCrLf & Microsoft.Dynamics.Framework.Reports.DataMethodUtility.ConvertUtcToAxUserTimeZoneForUser(Parameters!AX_CompanyName.Value, Parameters...

Assigning Delete Command to a Button

How to select multiple records and delete through delete button Create a button now change settings as per below Note: In delete button properties now change Multiselect option from Auto to Yes   [Control("Button")]     class FormButtonControl2     {         /// <summary>         ///         /// </summary>         public void clicked()         {             super();             cars_ds.deleteMarked();             // info("Number of Cars in Showroom",cars.RecId);         }

The Limitation of display Method

Display method is used for writing a code for Fields which are not existed in the form as field we need For writing display method we need to take class and write Chain of Command method for Table required Display method is used to concatenate the same data types like integers,strings etc 1.create a EDT type (could be string or integer based on the concatenation type (integer,string)) 2. click on the table where you want to write the display method 3.right click on the table methods and click on new method 4. copy the following code  public display TotalMatches sports()     {         TotalMatches Tot;         Tot=str2Int(this.Lost)+str2Int(this.Won);         return Tot;     } 5. after this go to form where you want to use this method 6. right click on form grid and create a field based on the EDT type 7. after creating the field go to field properties 8. give 1. datasource name and 2. data method In thi...