Thursday, April 6, 2023

Consolidation Report using x++

 Consolidation Report using x++.

 I got a requirement to create a consolidation report.

mean I need to fetch the data from multiple companies for this report.

  • I have used change company to get the data from different companies.
  • Before inserting it into my temp table again I have changed to the current company.

    container 	companyCon = ['CMP1','CMP2','CMP3'];
    str			curCompany = curext();

    while select mytable
    {
	for (int j = 1; j <= conLen(companyCon) ; j++)
	{
	    changecompany (conPeek(companyCon, j))
	    {
		// custom code
		// ..........
		//.........
			
		// Before inserting into temp table need to change as current company.
		changecompany (curCompany)
		{
		    ttsbegin;
		    consolidationTmp.insert();
		    ttscommit;
		}
			
	    }
	}
    }



Keep Daxing!!

No comments:

Post a Comment