giovedì 17 aprile 2014

VAR: Congratulations to Denis Macchinetti for the MVP award!

Congratulations to Denis Macchinetti for the MVP award!

http://sinedax.blogspot.it/2014/04/mvp-2014-on-dynamics-ax.html

HOWTO: Refresh display options at run time

If you need to refresh the display options of a record, after an update to the data of dataset or in another situation you don't to research or requery the database, but use the clearDisplayOption method on you datasource. The parameter of the method is the updated record.
yourTable_ds.clearDisplayOption(yourTable);
yourTable_ds.refresh();

mercoledì 29 gennaio 2014

HOWTO: Caching display methods

Dynamics AX 2009 :

Add this line code in the FORM method init

Public void init()
{
     super();
     this.cacheAddMethod(tablemethodstr(<table>,<display method>), [_updateOnWrite]);  
}

Dynamics AX 2012:

Add this line code in the DISPLAY method before the declaration

[SysClientCacheDataMethodAttribute([_updateOnWrite])]
Display method calcLeagueWon(int _num)
{
     If(juv || haveBoat())
          _num += 2

Return _num;
}

venerdì 24 gennaio 2014

HOWTO: Create counting journal

InventDim inventDim;
InventJournalTrans journalTrans;
TmpImportInventJournal tableBuffer;
InventJournalTable inventJournal;
real lineNum = 1;
TmpImportInventJournal tmpTable; // tmpTable here is used to stored item counting data
InventJournalName inventJournalName;
NumberSeq numberSeq;
;
ttsbegin;
select forupdate * from inventJournal
where inventJournal.JournalId == inventJournalId;
select firstonly inventJournalName
where inventJournalName.JournalNameId == InventParameters::find().CountJournalNameId;
numberSeq = NumberSeq::newGetVoucherFromCode(inventJournalName.VoucherSeqId);
while select * from tmpTable
{
inventDim.clear();
journalTrans.clear();
inventDim.initValue();
inventDim.configId = tmpTable.configId;
inventDim.inventBatchId = tmpTable.inventBatchId;
inventDim.InventLocationId = tmpTable.InventLocationId;
inventDim.inventSerialId = tmpTable.inventSerialId;
inventDim.InventSiteId = tmpTable.InventSiteId;
inventDim.wMSLocationId = tmpTable.wMSLocationId;
inventDim = InventDim::findOrCreate(inventDim);
journalTrans.Voucher = numberSeq.voucher();
journalTrans.initValue();
journalTrans.initFromInventJournalTable(inventJournal);
journalTrans.LineNum = lineNum;
journalTrans.JournalType = inventJournal.JournalType;
journalTrans.TransDate = tmpTable.TransDate;
journalTrans.ItemId = tmpTable.ItemId;
journalTrans.initFromInventTable(InventTable::find(tmpTable.ItemId));
journalTrans.Counted = tmpTable.Counted;
Try replacing the statement journalTrans.Counted = tmpTable.Counted with:
//
journalTrans.Counted = tmpTable.Counted;
journalTrans.InventOnHand = InventSumDatePhysicalDim::onHandQty(countDate, itemId, inventDim,tmpInventDimParm);
//
journalTrans.InventDimId = inventDim.inventDimId;
if (journalTrans.validateWrite())
{
JournalTrans.insert(NoYes::Yes);
JournalTrans.inventMovement().journalSetCounted();
JournalTrans.update();
}
//
lineNum ++;
}
inventJournal.NumOfLines = lineNum -1;
inventJournal.update();
tmpTable.clear();
delete_from tmpTable;
ttscommit;

lunedì 13 gennaio 2014

HOWTO: Recalculate InventSum

InventSumRecalcItem InventSumRecalcItem;

InventSumRecalcItem = new InventSumRecalcItem("ITEM001", true);
InventSumRecalcItem.updatenow();

TIP: Closed and closedQty in inventsum table

The closedQty flag informs that all quantities for given inventory item and inventory dimension set to zero. No item in stock, no item in process of receiving/shipping, also item is not expected to be sold/purchased/produced. The closed flag informs that the monetary balance for given item and inventory dimension is zero. Basically it means that all the costs related to given item was written-of from inventory account to COGS/WIP etc. Usually, the closed flag is set by inventory closing.
(But in simple cases it can be set immediately during posting of inventory issue). 

AX 2012: The request was aborted: Could not create SSL/TLS secure channel

The error you're encountering, "The request was aborted: Could not create SSL/TLS secure channel," can occur due to various re...