|
02.04.2008, 20:05 | #1 |
Участник
|
axStart: Derive from Derived RunbaseBatch classes.
Источник: http://axstart.spaces.live.com/Blog/...C0A0!292.entry
============== We all know how to extend from a runbaseBatch. But you have to be carful if you extend from that derived class again. You still want the integration with pack/unpack the correct way. Example: We want an additional text field on the dialog when posting a movement journal. For this example we have to override the next methods: · Dialog · getFromDialog · pack · uppack The class that we gone adapt is InventJournalCheckPost_Movement. Application hierarchy tree First we have to add the new field in the class declaration: class InventJournalCheckPost_Movement extends JournalCheckPostLedger { name text; DialogFIeld dlgField; #define.CurrentVersion(1) #define.Version1(1) #localmacro.CurrentList text #endmacro } The super() call in the getfromdialog , dialog and validate is similar like normal derived methods from runbaseBatch. Object dialog() { DialogRunbase ret; ret = super(); dlgField = ret.addFieldValue(typeid(string),myString,'text'); return ret; } boolean getFromDialog() { boolean ret; ret = super(); text = dlgField.value(); return ret; } public boolean validate(Object calledFrom) { boolean ret; ret = super(calledFrom); if(!text) ret = checkFailed('missing text'); return ret; } Now we have to add the super() in on the right place in the pack and unpack. The trick is that we add the container created by super() on the end of our own container. (We create nested containers) container pack() { return [#CurrentVersion, #CurrentList, super()]; } public boolean unpack(container packedClass) { boolean ret; Integer version = RunBase::getVersion(packedClass); container base; switch (version) { case #CurrentVersion: [version, #CurrentList,base] = packedClass; ret = super(base); break; default: this.initParmDefault(); ret = false; } return ret; } Finally you want to use the information in the process. The run method in the class JournalCheckPost contains the global setup of processing the movement. Derive the right runXXXX method in the InventJournalCheckPost_Movement class and keep calling super() in that method. In this derived method you can use your new text field and integrate it in the process. Источник: http://axstart.spaces.live.com/Blog/...C0A0!292.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|