Useful predefined functoins

Current date and time 

PurchTable.AccountingDate   = DateTimeUtil::date(DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::getSystemDateTime(), DateTimeUtil::getUserPreferredTimeZone())); 

with in qutoation string extraction

example :   'Test'

   int len = strLen(_formula);

   int exprVal1 = strScan(_formula,"'",1,len);

   int exprVal2 = strScan(_formula,"'",exprVal1+1,len);

   int exprVal1Act = exprVal1+1;

   if(exprVal1 && exprVal2)

   {

       Description typeId = subStr(_formula,exprVal1Act,exprVal2-(exprVal1Act));

  }

Num2Str convert number to string

num2Str(_value,1,2,DecimalSeparator::Dot,ThousandSeparator::None);


Formula conversion from string mathematics formula to result

 ProdMathEvaluator mathEvaluator = ProdMathEvaluator::construct();

 mathEvaluator.parmHandleException(true);

 mathEvaluator.parmThrowOnError(false);

 mathEvaluator.parmCalculationExpression(formula);

 formulaValue =  mathEvaluator.evaluateExpression();

 return formulaValue;


Loop through form datasource records fds and insertrecorded list , form refresh shiftF5  #Taskrestore 

 #Task        

 SIGSamplingTypeLine  sampleLine;

  NXRSamplingQualityReportSectionElements sectionElements;


  RecordInsertList insList = new RecordInsertList(tableNum(NXRSamplingQualityReportSectionElements),true,true,true,true,true);


  for (sampleLine = SIGSamplingTypeLine_ds.getFirst(true) ? SIGSamplingTypeLine_ds.getFirst(true) : SIGSamplingTypeLine_ds.cursor();

  sampleLine;

  sampleLine = SIGSamplingTypeLine_ds.getNext())

  {

      sectionElements.clear();

      sectionElements.ReportSecId = qualitySec.ReportSecId;

      sectionElements.TypeId = sampleLine.SampleId;

      insList.add(sectionElements);

  }

  insList.insertDatabase();


  element.task(#taskRefresh);


Comments

Popular posts from this blog

Ledger dimensions and financial Dimensions X++

Logistics address, postal address, address phone fax contact information

Consume odata/web api d365fo and parsing json content