This might be a bug.
I know it's possible to call datasource field properties like this
custTable_ds.object(fieldnum(custTable,Name)).skip(true);
this type of code is used a lot, i.e. in the price discount forms.
However, When you call the modified... e.g.
address_ds.object(fieldNum(Address,Name)).modified();
It calls the modified method on the table and not the form.
There MIGHT be a way around this, by using the tree node to run the
method.
e.g. use the tree node to find the method, then use the x++ compiler
to run it, e.g.
treenode::findNode('\\forms\\'+this.name()+'\\Data
Sources\\Address\\Fields\\Name\\Methods\\Modified\\')
... this might/might not work, sorry i haven't explored this kind of
code yet.
I suggest this because Standard Axapta uses something similar a lot,
check the method called "formhasmethod" in the class Global.
The alternative is simply to copy the code. Copy the code from the
modified and paste it into a new method in the form under the root
methods in the form. Then you can call this.
e.g.
Change this
public void modified()
{
;
// do some code
super();
// do some more code
}
to this
public void modified()
{
;
// element.dosomeCode();// create this method
super();
// element.doSomeMoreCode(); // create this method
}
--- In [email protected], hato <[EMAIL PROTECTED]>
wrote:
> hello mike,
>
> that helps a little, but i need the method on a particular field
from
> the datasource. in that case e.g. from the field "name" the method
> modified (if there would be a modified method) or any other.
>
> thanks anyway
> harry
>
>
> Michael Oakes wrote:
>
> >Look at the form AssetGroup in version 3.0
> >The clicked method on the button AssetGroupBookSetupBooks calls a
> >form datasource method.
> >void clicked()
> >{
> > super();
> > assetGroup_ds.findTmpAssetGroupCOT(assetGroup.GroupId, true);
> >}
> >
> >does this help?
> >
> >Mike Oakes
> >
> >--- In [email protected], hato <[EMAIL PROTECTED]>
> >wrote:
> >
> >
> >>hi,
> >>
> >>do anybody know how i can call a method from the datasource
within
> >>
> >>
> >a form?
> >
> >
> >>for example: in any method of the form "xy" i want to call the
> >>
> >>
> >method
> >
> >
> >>"modified()" from the formdatasource "abc"
> >>
> >>what i tried allready:
> >> 1. abc_ds.object(fieldnum(abc, field)).modified()
> >> 2. set the formcontroll autodeclaration to yes and call the
> >>
> >>
> >modified
> >
> >
> >>from that formcontrol
> >>what is not desired, to release the code in the modiefied and
call
> >>
> >>
> >that
> >
> >
> >>new method from everywhere.
> >>
> >>what is it good for:
> >> i want to use the code written in the datasources methods.
> >>
> >>thanks for help
> >>harry
> >>
> >>
> >
> >
> >
> >
> >
> >
> >Sharing the knowledge on Axapta.
> >Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
------------------------ Yahoo! Groups Sponsor --------------------~-->
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/kGEolB/TM
--------------------------------------------------------------------~->
Sharing the knowledge on Axapta.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Axapta-Knowledge-Village/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/