Tuesday 4 June 2019

Get duplicate line number based on search criteria in a table.

ImportStagingLine stagingLine1;
ImportStagingLine stagingLine2;
str               numberOfLines;
str               strToScan;
boolean           ret = true;
  

while select Recid, LineNum from stagingLine1
order by lineNum
join Recid, LineNum from stagingLine2
order by lineNum
where stagingLine2.ItemId == stagingLine1.ItemId
&& stagingLine2.InventSizeIdColour == stagingLine1.InventSizeIdColour

&& stagingLine2.AccountCode == stagingLine1.AccountCode

&& stagingLine2.AccountRelation == stagingLine1.AccountRelation

&& stagingLine2.MarkDownFromDate == stagingLine1.MarkDownFromDate

&& stagingLine2.Currency == stagingLine1.Currency

&& stagingLine2.PriceType == stagingLine1.PriceType

&& stagingLine2.RecId != stagingLine1.RecId

&& stagingLine2.StagingHeaderRefRecId == stagingLine1.StagingHeaderRefRecId

&& stagingLine1.StagingHeaderRefRecId == _refRecId

{

strToScan = strMin();
strToScan = strFmt("%1", stagingLine1.LineNum);


if (strScan(numberOfLines, strToScan, 1, strLen(numberOfLines)) == 0)
{
    numberOfLines += strFmt("%1-%2, %3", stagingLine1.LineNum, stagingLine2.LineNum, strMin()); }



ret = false; }


numberOfLines = strDel(numberOfLines, strLen(numberOfLines) -1, 3);

if (ret == false)
{
checkFailed(strFmt("For header record: %1 the line number: %2 are identical.", _refRecId, numberOfLines)); }



 

Insert/Update or remove the default dimension value in D365 FSCM via x++

Use below method to insert/update the dimension values, just pass the parameter values to the method and it will return the updated value: p...