Hi,
I have a report name and want to write a code to find whether a menuitem (in output) exists for that particular report or not.
The name of the report might not be the same in the menuitem/output node.
Please help me out.
Thanks and Regards,
Vikas Mehta.
this may help you
static void findingMenuItem(Args _args)
{
Dictionary dict = new Dictionary();
TreeNode menuItemsNode = TreeNode::findNode(@’\Menu Items\Output’);
TreeNodeIterator iterator = menuItemsNode.AOTiterator();
TreeNode menuItemNode = iterator.next();
SysDictMenu sysdictmenu;
;
while (menuItemNode)
{
sysdictmenu= SysDictMenu::newMenuItem(menuItemNode.treeNodeName(), MenuItemType::Output);
if(sysdictmenu.object().AOTname() == “AgentInvoice”)
{
print strfmt(“The Menu Item exists with Name → %1”,sysdictmenu.name());
break;
}
menuItemNode = iterator.next();
}
pause;
}
Hi,
Use function – Global::reportName2Pname(reportName)…
Naresh kolli
thanks Kranti,
your code worked for me.
I tried this:
while (enum.moveNext())
{
menuItem = enum.current();
if(menuItem.isMenuItem() && menuItem.isVisible() )
{
if(menuItem.menuItem().objectType()==str2enum(UtilElementType,“Report”) && menuItem.menuItem().object()==reportnamestr)
{
info(menuItem.label());
}
}
}
Small change in the above code.
static void findingMenuItem(Args _args)
{
Dictionary dict = new Dictionary();
TreeNode menuItemsNode = TreeNode::findNode(@’\Menu Items\Output’);
TreeNodeIterator iterator = menuItemsNode.AOTiterator();
TreeNode menuItemNode = iterator.next();
SysDictMenu sysdictmenu;
;
while(menuItemNode)
{
sysdictmenu = SysDictMenu::newMenuItem(menuItemNode.treeNodeName(), MenuItemType::Output);
if(sysdictmenu.menuItem().object() == “ReportName”)///here is the change
{
info(strfmt(“The Menu Item exists with Name → %1”,sysdictmenu.name()));
}
menuItemNode = iterator.next();
}
pause;
}
thanks,
that change was understood.