static void defaultDimension(Args _args)
{
PurchLine purchLine;
DimensionAttributeValueSetStorage dimStorage;
int counter;
container attribute = ["BusinessUnit", "Department", "ItemGroup"];
DimensionAttribute dimensionAttribute;
DimensionAttributeValue dimensionAttributeValue;
;
purchLine = PurchLine::findRecId(35637329190);//sample to get default dimension
dimStorage = DimensionAttributeValueSetStorage::find(purchLine.DefaultDimension);
//all attribute
for (counter= 1 ; counter<= dimStorage.elements() ; counter++)
{
dimensionAttribute = DimensionAttribute::find(dimStorage.getAttributeByIndex(counter));
dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, dimStorage.getDisplayValueByDimensionAttribute(dimensionAttribute.RecId));
info(strFmt("%1 - %2", dimStorage.getDisplayValueByDimensionAttribute(dimensionAttribute.RecId), dimensionAttributeValue.getName()));
}
//specific attribute
for (counter= 1 ; counter<= conLen(attribute) ; counter++)
{
dimensionAttribute = DimensionAttribute::findByName(conPeek(attribute, counter));
dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, dimStorage.getDisplayValueByDimensionAttribute(dimensionAttribute.RecId));
info(strFmt("%1 - %2", dimStorage.getDisplayValueByDimensionAttribute(dimensionAttribute.RecId), dimensionAttributeValue.getName()));
}
}
Showing posts with label AX2012. Show all posts
Showing posts with label AX2012. Show all posts
2019-09-12
[AX2012] Get Default Dimension Value and Description
This is a job to show value and description of a default dimension.
2019-07-26
[AX 2009] Access Form Control by Code
This is a sample to change formstringcontrol label by code without autodeclaration. Control::GroupPayment_M_paymentDescription is a control id. The control id is formed from Control::+"Control Name".
public void run()
{
FormStringControl paymentDesc;
;
paymentDesc = element.control(Control::GroupPayment_M_paymentDescription);
paymentDesc.label("Payment description");
}
//AX2012
element.control(element.controlId(formControlStr(CustInvoice, GroupPayment_M_paymentDescription))).label("Payment description");
public void run()
{
FormStringControl paymentDesc;
;
paymentDesc = element.control(Control::GroupPayment_M_paymentDescription);
paymentDesc.label("Payment description");
}
//AX2012
element.control(element.controlId(formControlStr(CustInvoice, GroupPayment_M_paymentDescription))).label("Payment description");
Form control type
|
Class
|
ActiveX
|
FormActiveXControl
|
Animate
|
FormAnimateControl
|
Button
|
FormButtonControl
|
ButtonGroup
|
FormButtonGroupControl
|
CheckBox
|
FormCheckBoxControl
|
ComboBox
|
FormComboBoxControl
|
CommandButton
|
FormCommandButtonControl
|
DateEdit
|
FormDateControl
|
Grid
|
FormGridControl
|
Group
|
FormGroupControl
|
GuidEdit
|
FormGuidControl
|
HTML
|
FormHTMLControl
|
Int64Edit
|
FormInt64Control
|
IntEdit
|
FormIntControl
|
ListBox
|
FormListBoxControl
|
ListView
|
FormListControl
|
MenuItemButton
|
FormFunctionButtonControl
|
MenuButton
|
FormMenuButtonControl
|
Progress
|
FormProgressControl
|
RadioButton
|
FormRadioControl
|
RealEdit
|
FormRealControl
|
StaticText
|
FormStaticTextControl
|
StringEdit
|
FormStringControl
|
Tab
|
FormTabControl
|
TabPage
|
FormTabPageControl
|
Table
|
FormTableControl
|
TimeEdit
|
FormTimeControl
|
Tree
|
FormTreeControl
|
Window
|
FormWindowControl
|
2018-12-04
[AX 2012] Create Default SpecQty on Product Receipt Posting Form
Table PurchParameters
if(PurchParameters::find().PromptQty)
{
recommendedQty = purchFormLetter.recommendedSpecQty();
if(recommendedQty != specQty.selection())
{
boxFormOnceIsActive = true;
if(documentStatus != DocumentStatus::PackingSlip)
{
box = BoxFormOnce::construct();
box.parmDialogBoxType(DialogBoxType::YesNoBox);
box.parmDialogButton(DialogButton::Yes);
box.parmTitle("@SYS59372");
box.parmText(strFmt("@SYS102340", salesUpdateEnum.index2Name(specQty.selection()), salesUpdateEnum.index2Name(recommendedQty)));
box.parmOwner(new SysDictClass(classIdGet(purchEditLinesForm)).name());
if(box.prompt() == DialogButton::Yes)
{
specQty.selection(recommendedQty);
specQty.selectionChange();
}
}
else
{
specQty.selection(recommendedQty);
specQty.selectionChange();
}
boxFormOnceIsActive = false;
}
}
PurchUpdate recommendedSpecQty(DocumentStatus _documentStatus)Form PurchEditLines
{
PurchUpdate specQty;
switch (_documentStatus)
{
case DocumentStatus::Invoice :
specQty = PurchUpdate::PackingSlip;
break;
case DocumentStatus::PackingSlip :
specQty = PurchUpdate::ReceiveNow;
break;
default:
specQty = PurchUpdate::All;
break;
}
return specQty;
}
if(PurchParameters::find().PromptQty)
{
recommendedQty = purchFormLetter.recommendedSpecQty();
if(recommendedQty != specQty.selection())
{
boxFormOnceIsActive = true;
if(documentStatus != DocumentStatus::PackingSlip)
{
box = BoxFormOnce::construct();
box.parmDialogBoxType(DialogBoxType::YesNoBox);
box.parmDialogButton(DialogButton::Yes);
box.parmTitle("@SYS59372");
box.parmText(strFmt("@SYS102340", salesUpdateEnum.index2Name(specQty.selection()), salesUpdateEnum.index2Name(recommendedQty)));
box.parmOwner(new SysDictClass(classIdGet(purchEditLinesForm)).name());
if(box.prompt() == DialogButton::Yes)
{
specQty.selection(recommendedQty);
specQty.selectionChange();
}
}
else
{
specQty.selection(recommendedQty);
specQty.selectionChange();
}
boxFormOnceIsActive = false;
}
}
[AX 2012] Hide Cancel Button on Dialog
void showTotals()
{
Dialog dlg = new Dialog("Totals");
DialogField rfpAmount;
DialogField settlAmount;
DialogField totalAmount;
formBuildCommandButtonControl cancelButton;
;
rfpAmount = dlg.addFieldValue(extendedTypeStr(Amount), MIORFPTable.TotalReqAmt, "Cash Advance", "Cash Advance");
rfpAmount.active(false);
settlAmount = dlg.addFieldValue(extendedTypeStr(Amount), MIORFPSettlementTable.TotalSetAmt, "Actual", "Actual");
settlAmount.active(false);
totalAmount = dlg.addFieldValue(extendedTypeStr(Amount), MIORFPTable.TotalReqAmt - MIORFPSettlementTable.TotalSetAmt, "Settle", "Settle");
totalAmount.active(false);
dlg.defaultButton(DialogDefaultButton::Ok);
dlg.alwaysOnTop(true);
dlg.dialogForm().form().design().left(48, 4);
dlg.dialogForm().form().design().top(240, 3);
cancelButton = dlg.dialogForm().control("cancelButton");
cancelButton.visible(false);
dlg.run();
}
{
Dialog dlg = new Dialog("Totals");
DialogField rfpAmount;
DialogField settlAmount;
DialogField totalAmount;
formBuildCommandButtonControl cancelButton;
;
rfpAmount = dlg.addFieldValue(extendedTypeStr(Amount), MIORFPTable.TotalReqAmt, "Cash Advance", "Cash Advance");
rfpAmount.active(false);
settlAmount = dlg.addFieldValue(extendedTypeStr(Amount), MIORFPSettlementTable.TotalSetAmt, "Actual", "Actual");
settlAmount.active(false);
totalAmount = dlg.addFieldValue(extendedTypeStr(Amount), MIORFPTable.TotalReqAmt - MIORFPSettlementTable.TotalSetAmt, "Settle", "Settle");
totalAmount.active(false);
dlg.defaultButton(DialogDefaultButton::Ok);
dlg.alwaysOnTop(true);
dlg.dialogForm().form().design().left(48, 4);
dlg.dialogForm().form().design().top(240, 3);
cancelButton = dlg.dialogForm().control("cancelButton");
cancelButton.visible(false);
dlg.run();
}
2018-10-31
[AX2012] Comparing Two Record
To compare the original and updated (dirty) record, use equal method. Do this below method before write the table record.
void modifiedRecord()
{
;
//in not equal, update user or manager update field
if(!(MIOSQTable.orig().equal(MIOSQTable)) || !(MIOSQVendReply.orig().equal(MIOSQVendReply)))
{
if(isUser)
MIOSQTable.UserUpdate = NoYes::Yes;
if(isManager)
MIOSQTable.ManagerUpdate = NoYes::Yes;
}
}
2018-10-19
[AX2012] Ledger Dimension Description
display Description getLedgerDimensionDesc()
{
DimensionStorage dimensionStorage;
DimensionStorageSegment segment;
Description dimDesc;
int hierarchyIndex, hierarchyCount;
int segmentIndex, segmentCount;
Name segmentName;
;
dimensionStorage = DimensionStorage::findById(this.LedgerDimension);
if(!dimensionStorage)
return dimDesc;
hierarchyCount = dimensionStorage.hierarchyCount();
for(hierarchyIndex=1; hierarchyIndex<=hierarchyCount; hierarchyIndex++)
{
segmentCount = dimensionStorage.segmentCountForHierarchy(hierarchyIndex);
for(segmentIndex=1; segmentIndex<=segmentCount; segmentIndex++)
{
segment = dimensionStorage.getSegmentForHierarchy(hierarchyIndex, segmentIndex);
if(segment.parmDimensionAttributeValueId()!=0)
{
segmentName = segment.getName();
if(!dimDesc)
dimDesc = segmentName;
else
dimDesc += "-"+segmentName;
}
}
}
return dimDesc;
}
2018-02-26
[AX2012] Parallel Compile X++ And Deploy All Reports
Compile X++
Command Prompt:
C:\>cd "Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin"
C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin>axbuild.exe xppcompileall /s=01 /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin"
Deploy Reports
Microsoft Dynamics AX 2012 Management Shell:
Command Prompt:
C:\>cd "Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin"
C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin>axbuild.exe xppcompileall /s=01 /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin"
Deploy Reports
Microsoft Dynamics AX 2012 Management Shell:
Publish-AXReport –ReportName *
2017-03-31
[AX2012] Minimum On-hand on On-hand Form
Put display method in InventSum datasource:
\Forms\InventOnhandItem\Data Sources\InventSum\Methods\inventOnHandMin
Then put this method in overview grid.
\Forms\InventOnhandItem\Data Sources\InventSum\Methods\inventOnHandMin
display public InventQtyMinOnhand inventOnHandMin(InventSum _inventSum)
{
InventDim joinDim, dimValues;
InventDimParm dimParm;
ReqItemTable reqItemTable;
dimValues.data(_inventSum.joinChild());
dimParm.initFromInventDim(dimValues);
select sum(MinInventOnhand) from reqItemTable where reqItemTable.ItemId == _inventSum.ItemId
#InventDimExistsJoin(reqItemTable.CovInventDimId, joinDim, dimValues, dimParm);
return reqItemTable.MinInventOnhand;
}
Then put this method in overview grid.
Subscribe to:
Posts (Atom)