How can i pass parameters(possible values from BaseEnumType) to MenuItems so that later according to the value to activate different Report....Please help
Soory but i'm hopeless whst i did is created 3 action MenuItems and a class which is speciafied in their Object property. In the main method of the class i wrote this:
static void main(args a)
{
ReportRun runRep;
Args args;
EnumType enumType;
;
switch(enumType)
{
case EnumType ::Type1 : args = new Args("ReportA");
runRep = new reportRun(args);
runRep.run();
case EnumType ::Type2: args = new Args("ReportB");
runRep = new reportRun(args);
runRep.run();
case EnumType ::Type3 : args = new Args("ReportC");
runRep = new reportRun(args);
runRep.run();
case EnumType ::Type4 : args = new Args("ReportD");
runRep = new reportRun(args);
runRep.run();
}
}
I'm getting an error saying that no object is specified for the action MenuItem (and it is specied ) and that there is no design specified for the report so...I'm totally lost..Please help me
ok but where i have to place the code for that method void callMyClassWithArgs() (that you gave me as an example), i call the action menu items from MenuItemButtons...
Comments
1. Description of properties for menu items
2. Activating a menu item from your X++ code
and about the Args class under AOT\System documentation\Classes.
Good luck
Ciprian Dudau
Axapta Developer
static void main(args a)
{
ReportRun runRep;
Args args;
EnumType enumType;
;
switch(enumType)
{
case EnumType ::Type1 : args = new Args("ReportA");
runRep = new reportRun(args);
runRep.run();
case EnumType ::Type2: args = new Args("ReportB");
runRep = new reportRun(args);
runRep.run();
case EnumType ::Type3 : args = new Args("ReportC");
runRep = new reportRun(args);
runRep.run();
case EnumType ::Type4 : args = new Args("ReportD");
runRep = new reportRun(args);
runRep.run();
}
}
I'm getting an error saying that no object is specified for the action MenuItem (and it is specied ) and that there is no design specified for the report so...I'm totally lost..Please help me
supposing you call a class using an ActionMenuItem ...
void callMyClassWithArgs()
{
args = new args();
menufunction mf;
;
args.parmEnumType(enumNum(MyEnum));
args.parmEnum(MyEnum::MyValue);
mf = new menufunction(MenuItemType::action,menuitemactionstr(mymenuitem));
mf.run(args);
}
then in the main method of class you will do something like
static void main(args args)
{
myenum myenum;
;
myenum = args.parmenum();
(do the switch and the rest of stmts...)
}
Please see that you can also set enum parameters to a Menuitem directly from properties.
Ciprian Dudau
Axapta Developer
OR
overwrite the clicked() method of the menuitembutton, delete super() and place my code instead...
Ciprian Dudau
Axapta Developer