Wednesday, October 21, 2020

Refresh DataSource and retain to same position in Ax 2012 X++

 

Hi guys, Today we see when I run execute query I don't want to change active record cursor position in ax 2012 X++.Refresh DataSource and retain to same position.

Here we have 2 ways Just check below.

Code 1:  Here we use Get and Set methods.

    Int         position;

    position = TestTable_ds.getPosition();

   TestTable_ds.executeQuery();

    TestTable_ds.setPosition(position);


Code 2:  we can use Recid also. This is more efficient compared Code 1.

    TestTable    testTable;

    testTable.RecId = TestTable.RecId;

    TestTable_ds.executeQuery();

    TestTable_ds.findRecord(testTable); 


Keep Daxing!!


How to get Product Variants in AX 2012 X++


Hi guys, Today we see how to get product variants in Ax 2012 using X++.

Run the below code.


static void getProductVariants(Args _args) 

{

InventDimCombination inventDimCombination;
InventDim                     inventDim;

while select inventDimCombination

   where inventDimCombination.ItemId == 'D0006'

      join inventDim

          where inventDim.inventDimId == inventDimCombination.InventDimId

  {

      info(strFmt('%1 : %2 : %3 : %4 : %5',

             inventDimCombination.DistinctProductVariant,

             inventDim.configId,

             inventDim.InventColorId,

             inventDim.InventSizeId,

             inventDim.InventStyleId));     

  }

Keep Daxing!!