Axapta 2009 : Axapta สร้าง List Department ให้เลือก จาก Dimension Group
If
you want to use a particular dimension as a dialog field in Dynamics AX
2009 (or earlier versions), you can create your own Extended Data Type
(derived from Criterias) as described below. The decisive factors are
the relations of this EDT.
In the example, the cost center is to be offered as a dialog field.
- protected Object dialog(DialogRunbase dialog, boolean forceOnClient)
- {
- Object ret;
- ret = super(dialog, forceOnClient);
- df_project = ret.addField(TypeId(DimensionACEdit));
- return ret;
- }
Button Edit Show Dialog
Code In GL Edit Department AC
- void clicked()
- {
- //LedgerJournalTrans_ds.allowEdit(true);
- Dialog myDialog;
- DialogField myDialogFieldDepartment;
- LedgerJournalTrans myLedgerJournalTrans;
- LedgerJournalTrans LedgerJournalTransUpdate;
- ;
- super();
- myLedgerJournalTrans = ledgerJournalTrans_ds.cursor();
- myDialog = new Dialog("Department Edit.");
- myDialogFieldDepartment = myDialog.addFieldValue(typeId(DimensionACEdit), '', "void clicked()
- {
- //LedgerJournalTrans_ds.allowEdit(true);
- Dialog myDialog;
- DialogField myDialogFieldDepartment;
- LedgerJournalTrans myLedgerJournalTrans;
- LedgerJournalTrans LedgerJournalTransUpdate;
- ;
- super();
- myLedgerJournalTrans = ledgerJournalTrans_ds.cursor();
- myDialog = new Dialog("Department Edit.");
- myDialogFieldDepartment = myDialog.addFieldValue(typeId(DimensionACEdit), '', "Departmaint :");
- if(myDialog.run()){
- //if(box::yesNo("Press 'Yes' to Confirm / Press 'No' to Cancel", DialogButton::No, "Please select...") == DialogButton::Yes){
- ttsbegin;
- SELECT FORUPDATE * FROM LedgerJournalTransUpdate
- WHERE LedgerJournalTransUpdate.RecId == myLedgerJournalTrans.RecId;
- {
- LedgerJournalTransUpdate.DimensionACEdit[1] = myDialogFieldDepartment.value();
- LedgerJournalTransUpdate.update();
- LedgerJournalTrans_ds.reread();
- LedgerJournalTrans_ds.refresh();
- }
- ttscommit;
- //} //Close If.
- } //Close If.
- }:");
- if(myDialog.run()){
- //if(box::yesNo("Press 'Yes' to Confirm / Press 'No' to Cancel", DialogButton::No, "Please select...") == DialogButton::Yes){
- ttsbegin;
- SELECT FORUPDATE * FROM LedgerJournalTransUpdate
- WHERE LedgerJournalTransUpdate.RecId == myLedgerJournalTrans.RecId;
- {
- LedgerJournalTransUpdate.DimensionACEdit[1] = myDialogFieldDepartment.value();
- LedgerJournalTransUpdate.update();
- LedgerJournalTrans_ds.reread();
- LedgerJournalTrans_ds.refresh();
- }
- ttscommit;
- //} //Close If.
- } //Close If.
- }
No comments:
Post a Comment