Saturday, July 9, 2022

Financial dimension sets values lookup X++

Hi guys,

In this blog, I will explain how to create Financial dimension sets values lookup.

Requirement:

I came across a requirement where in Financial dimension sets values lookup were required on the dialog form and General ledger balances for Main accounts with Financial dimensions calculated based on the Financial dimension set values selected on the dialog form just like calculation on General ledger trial balance form.

Solution:

Create an extended class that handles the logic of loading Financial dimension sets values on dialog control lookup.

Extend the class with SysLookup class to reuse SysTableLookup methods for generating lookup from the SysLookup class

 class FinDimSetValuesLookup extends SysLookup  
 {  
   /// <summary>  
   /// This method is used to load Financial dimension sets values on dialog control lookup  
   /// </summary>  
   /// <param name="_formControl">Gets the form control of financial dimension sets lookup</param>  
   public void dimensionHierarchyLookup(FormControl _formControl)  
   {  
     Query             query;  
     SysTableLookup     sysTableLookup;  
     QueryBuildRange     queryBuildRange;  
     QueryBuildDataSource  qbds;  
     query = new Query();  
     qbds = query.addDataSource(tableNum(DimensionHierarchy));  
     // Filter dimension hierarchy to only show focuses that are not deleted.  
     queryBuildRange = qbds.addRange(fieldnum(DimensionHierarchy, StructureType));  
     queryBuildRange.value(queryValue(DimensionHierarchyType::Focus));  
     queryBuildRange.status(RangeStatus::Hidden);  
     queryBuildRange = qbds.addRange(fieldnum(DimensionHierarchy, DeletedVersion));  
     queryBuildRange.value(queryValue(0));  
     queryBuildRange.status(RangeStatus::Hidden);  
     sysTableLookup = SysTableLookup::newParameters(tableNum(DimensionHierarchy), _formControl, true);  
     sysTableLookup.addLookupfield(fieldNum(DimensionHierarchy, Name));  
     sysTableLookup.parmQuery(query);  
     sysTableLookup.performFormLookup();  
   }  
 }  

No comments:

Post a Comment

Enable and Disable Vendor invoice button on PO list and details page X++

Hi folks, This blog will be useful where vendor invoice process is required to be controlled based on certain conditions. Requirements: Proc...