Tuesday 9 October 2018

Update Product numbers for Released and Product Master

In one of my projects, there was a requirement for bulk renaming the released products and the product master. Luckily, the numbers for both released and master were kept the same for me to filter on the PKs conveniently. Used the code below to achieve that.

static void RenameInvenTableProdsPK(Args _args)
{
    InventTable inventTable;
    str oldDisplayNumber,newDisplayNumber;
    int iCount;
    CommaIo file;
    ;
    file = new CommaIo(@"\\XXXXX\file.csv","W");
    While select ItemId from InventTable where inventTable.ItemId like 'B4*'
    {
        try
        {
            oldDisplayNumber = inventTable.ItemId;
            newdisplayNumber = "O_"+inventTable.ItemId;
            inventTable.ItemId = newdisplayNumber;
            inventTable.renamePrimaryKey(); //old method of product renaming
           
            //using the service to rename product master
            EcoResProductNumberRenameService::newFromProduct(
            EcoResProduct::findByProductNumber(oldDisplayNumber).RecId,
            oldDisplayNumber,
            newdisplayNumber,NoYes::Yes).rename(); //one of the attributes allows us to include product variants in the renaming process
            iCount++;
    }
    
    catch{
        file.write(oldDisplayNumber);
        continue;
    }
    }
   info(strFmt("Done - %1",iCount));  
}


1 comment:

  1. Winning with a natural eight awards double while profitable with a 7 or under is just equal to the wager. Players can request additional playing cards which are dealt face up; if it is a ten or a face card, they will reject it and ask for one more. In an early model of this game, going over 9 with extra playing cards quantities to a "bust" as in blackjack, later versions use modulo 10 arithmetic as in the 소울카지노 other games. Beating the banker with a pair only awards an equal quantity to the wager. When the deck is exhausted, the player to the banker's left turns into the new new} banker.

    ReplyDelete