Reputation: 1
Scenario: I've created two simple forms. The Form1 is a simple StringEdit control with a button. The Form2 is a set of different controls and buttons and Form2 opens after clicking the button of the Form1.
What I need: What I need is the Form2 initialized with the value set in the StringEdit control of the Form1.
I tried to do it assigning DataSource and DataField to the StrinEdit control and it worked:
void clicked()
{
Args args;
FormRun formRun;
;
args = new Args();
args = element.args();
args.name(formStr(Form3));
args.record(SMAServiceOrderTable);
formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
super();
}
public void init()
{
SMAServiceOrderTable serviceordertable;
super();
serviceordertable = element.args().record();
}
But this works when a DataSource and a DataField is associated to the StringEdit. Could someone explain me how should I build it to pass the value of Form1 to Form2 when is an ExtendedDataType?
Thank you.
Upvotes: 0
Views: 569
Reputation: 426
Option 1, use args.caller(element) to form1 instance and in Form1 create a method to return value of string field it will work. Option 2 is to override button click method to open Form2 through code and that time you can pass arguments to form. Also refer this blog https://calebmsdax.wordpress.com/2013/02/22/passing-parameters-between-forms-in-ax/
Upvotes: 0
Reputation: 6696
If you've been able to use args.record()
to pass the record to the called object (Form2), you can also use args.parm()
to pass a string value, args.parmEnum()
and args.parmEnumType()
to pass an enum value, or args.parmObject()
to pass any object. You can also use args.caller(element)
so that Form2 can have access to Form1 methods.
Upvotes: 1