martedì 14 ottobre 2014

HOWTO: Create invent marking

Here an exaple for create a mark by code:

InventTrans issueInventTrans;
TmpInventTransMark tmpInventTransMask;
Map mapMarkNow;
container con;
real qty;
Map mapTmp;
MapEnumerator mapEnumerator;

InventTransOriginId issueInventTransOriginId = 
InventTransOrigin::findByInventTransId('Issue lot ID').RecId;

InventTransOriginId receiptInventTransOriginId = 
InventTransOrigin::findByInventTransId('Receipt lot ID').RecId;    

InventQty qtyToMark = 11;

ttsBegin;

issueInventTrans = InventTrans::findByInventTransOrigin(
issueInventTransOriginId);

[con, qty] = TmpInventTransMark::packTmpMark(
InventTransOrigin::find(issueInventTransOriginId),
issueInventTrans.inventDim(), 
issueInventTrans.Qty);

mapTmp = Map::create(con);
mapEnumerator = mapTmp.getEnumerator();
while (mapEnumerator.moveNext())
{
tmpInventTransMask = mapEnumerator.currentValue();

if (tmpInventTransMask.InventTransOrigin == receiptInventTransOriginId)
{
tmpInventTransMask.QtyMarkNow = qtyToMark;
tmpInventTransMask.QtyRemain -= tmpInventTransMask.QtyMarkNow;
mapMarkNow = new Map(Types::Int64, Types::Record);
mapMarkNow.insert(tmpInventTransMask.RecId, tmpInventTransMask);

TmpInventTransMark::updateTmpMark(
issueInventTransOriginId, 
issueInventTrans.inventDim(), 
-qtyToMark,
mapMarkNow.pack());

break;
}
}

ttsCommit;

giovedì 9 ottobre 2014

TIP: Automatic open an entity when double click on the info dialog

In this case the user can double click on info dialog to go directly on the production order

info(strfmt("Production order %1 was created", prodTable.ProdId),'', SysInfoAction_TableField::newBuffer(prodTable));

HOWTO: Create transfer order by code X++

NumberSeq numberSeq;
InventTransferTable inventTransferTable;
InventTransferLine inventTransferLine;
InventDim inventDim;
;

ttsbegin;
numberSeq = NumberSeq::newGetNum(InventParameters::numRefTransferId());

inventTransferTable.clear();
inventTransferTable.initValue();
inventTransferTable.TransferId = numberSeq.num();
numberSeq.used();

inventTransferTable.InventLocationIdFrom = _inventLocationIdFrom;
inventTransferTable.modifiedField(fieldNum(InventTransferTable,InventLocationIdFrom));
inventTransferTable.InventLocationIdTo = _inventLocationIdTo;
inventTransferTable.modifiedField(fieldNum(InventTransferTable,InventLocationIdTo));
inventTransferTable.insert();

inventTransferLine.clear();
inventTransferLine.initFromInventTransferTable(inventTransferTable, NoYes::Yes);
inventTransferLine.ItemId = _itemId;
inventTransferLine.initFromInventTable(InventTable::find(_itemId));
inventTransFerLine.LineNum = InventTransferLine::lastLineNum(inventTransferTable.TransferId) + 1;
inventTransferLine.QtyTransfer = _qty;
inventTransferLine.QtyRemainReceive = _qty;
inventTransferLine.QtyRemainShip = _qty;
inventTransferLine.QtyShipNow = 0;
inventTransferLine.QtyReceiveNow = 0;
inventDim = inventTransferLine.inventDim();
inventDim.InventSiteId = InventLocation::find(inventTransferTable.InventLocationIdFrom).InventSiteId;
inventDim.InventLocationId = inventTransferTable.InventLocationIdFrom;
inventTransferLine.InventDimId = inventDim::findOrCreate(inventDim).inventDimId;
inventTransferLine.insert();
ttscommit;

giovedì 2 ottobre 2014

HOWTO: SSRS show value only on last page in body of report

If you wont to display a value only on last page use a syntax like this on field exp:

=iif(Globals!PageNumber=Globals!TotalPages,data, nothing)

If you wont to hide a control only on a last page use a syntax like this on visibility exp:

=iif(Globals!PageNumber=Globals!TotalPages,false,true)

Remember you case use Global properties only on header and footer section

mercoledì 1 ottobre 2014

HOWTO: AX 2012, How to use Date range and Enum in query value

Use this piece of code for fiter datasource beetween two date:


qbds.addRange(fieldNum(EIRTenderRecordTable, StartDate))
        .value(SysQuery::range(_requisitionDate, dateNull()));

qbds.addRange(fieldNum(EIRTenderRecordTable, EndDate))
        .value(SysQuery::range(dateNull(), _requisitionDate));

venerdì 19 settembre 2014

TIP: The report parameters are overridden by the parameter on SSRS Report

The report parameters are overridden by the parameter on SSRS Report.

2013-09-30_1910.png (304×351)

Dynamics AX SSRS engine ignore the parameter like this:

[DataMemberAttribute, SysOperationControlVisibilityAttribute(false)]
public LogisticsAddressing parmAddress(LogisticsAddressing _address = companyAddress)
{
companyAddress = _address;
return companyAddress;
}


giovedì 18 settembre 2014

SSRS: After modify of a report data provider class

If you modify a report, on 2012 version, using on SSRS.
But after modify data provider class, modity report layour, do report modification, deploy and do an incremental CIL compilation you:

* can see the result, using dynamics, but only the layout of the report, and no data on new columns
* and you can see the report goes good on visual studio internal preview


The solution is to restart the SSRS Reporting Services service where it's installed, in my case on the same of AOS Machine.

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...