Description:
Here I have given simple demonstration to pass container one form to another in ax 2012.
Form-2 Form init method.
In form init method also you can validate for DataSource like below. Which DataSource you are pass as argument from Form-1.
Here I have given simple demonstration to pass container one form to another in ax 2012.
Here I have given example to
pass container in one form to another form in ax 2012. On your button click
event create declare container and store you value.
Form-1 Button click event.
FormRun formRun; Args args = new Args(); str multiSelectString; container con; super(); con = conIns(con,1, strFmt("%1",Value1)); con = conIns(con,2, strFmt("%1", Value2)); con = conIns(con,3, Value3); con = conIns(con,4, Value4); con = conIns(con,5, Value5); con = conIns(con,6, Value6); con = conIns(con,7, Value7); multiSelectString = con2Str(con,','); args.name(formstr(FormName)); args.caller(this); args.parm(multiSelectString); //Which DataSource you want to pass args.record(DataSourceName); formRun = classfactory.formRunClass(args); formRun.init(); formRun.run(); formRun.wait(); formRun.detach();
Form-2 Form init method.
container con; str multipleRecords; int i1; super(); //dataset start if(element.args().dataset()) { //parmObject start if(element.args().parm()) { //Getting multipleRecords Value start multipleRecords = element.args().parm(); con = str2con(multipleRecords,","); for(i1 = 1;i1<= conLen(con) ;i1++) { if(i1==1){Value1 = strFmt("%1",conPeek(con,i1));} if(i1==2){ Value2 = strFmt("%1",conPeek(con,i1));} if(i1==3){ Value3= conPeek(con,i1);} if(i1==4){ Value4 = conPeek(con,i1);} if(i1==5){ Value5 = conPeek(con,i1);} if(i1==6){ Value6 = conPeek(con,i1);} if(i1==7){ Value7 = conPeek(con,i1);_TransDate = str2Date(_Getdate,123); } } //Getting multipleRecords Value end } //parmObject end } //dataset end
In form init method also you can validate for DataSource like below. Which DataSource you are pass as argument from Form-1.
public void init() { //if not from InventDim dataset if( element.args().dataset() == tableNum(TableName)) { super(); } //if directly open if(!element.args().caller()) { throw error("Cannot Run Directly."); } }
Thanks for comments.....