Thursday, March 2, 2023

How to update fixed asset dimensions values with the assigned purchase order dimension values

 public final class DaxtransferDimensionValues

{

    public static void main(Args args)

    {        

AssetTable          assetTable;

        AssetBook           assetBook;

        PurchTable          purchTable;

        RecordSortedList    assetBookList;

        DimensionDefault    defaultDimension;

        TransferDate        transferDate;

        TransferComment     transferComment;

        AssetTransfer       assetTransfer;               

assetTransfer = AssetTransfer::construct(); 

assetTable = args.record();           

        assetBookList = new RecordSortedList(tableNum(AssetBook));

        assetBookList.sortOrder(fieldNum(AssetTable, RecId));        

        transferDate = DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone());

        transferComment = "comment";

        select purchTable join assetBook 

           where purchTable.PurchId == assetBook.PurchId

            join assetTable where assetBook.AssetId == assetTable.AssetId;

        defaultDimension = purchTable.DefaultDimension;

        assetBookList.ins(assetBook);

        assetTransfer.transferAsset(assetBookList,defaultDimension,transferDate,transferComment);

     }  

}


No comments:

Post a Comment