This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Question about exclusions

RonCK - Thursday, June 11, 2009 5:10 PM:

Is it possible to exclude the Part BOM relationship tab on a Part form for parts that are not of type Assembly?  I was looking at the Just Ask Aras help and saw the Exclude tab on Relationship View type but it appears that you can only exclude based on other relationships rather than classifications.  Anyone have any ideas how to step around that?

 

thanks,

RonCK



Brian - Thursday, June 11, 2009 11:31 PM:

Hi Ron,

In the Demo Database (available from the projects site) the Part form hides certain tabs based on business logic.

The method called as part of the Form Events in onFormPopulated is called HidePartTabsByBusinessLogic.

Essentially it checks for the classification of the item then hides tabs based on your classification rules.

This cut down method hides the goals tab after testing the classification

top.hideTab = function() {

 // If the tabbar is not yet ready, wait a bit and call the function recursively
 if (!parent.relationships || !parent.relationships.relTabbarReady || parent.relationships.relTabbar.GetTabOrder("|") === "" ) {
  setTimeout("top.hideTab();", 30);
  return;
 
}
var thisClass  = new String(document.thisItem.getProperty("classification",""));
 
var tabbar = parent.relationships.relTabbar;
if ( thisClass == "/Part/Assembly/Mechanical" )
{
tabid = tabbar.GetTabId("Goals");
tabbar.SetTabVisible(tabid,false);
}
};
setTimeout("top.hideTab();", 30);

 

Cheers,

Brian.



RonCK - Monday, June 15, 2009 11:15 AM:

Thanks Brian, that worked fine.  I just added this to the non Assembly forms:

// name: PhnxHideBOMTabsForParts
// purpose: Hide the BOM tab on parts that are not of Assembly Type
// created: 09/06/12 by RonCK

top.hideTab = function()
{
   // If the tabbar is not yet ready, wait a bit and call the function recursively
   if (!parent.relationships || !parent.relationships.relTabbarReady || parent.relationships.relTabbar.GetTabOrder("|") === "" )
   {
      setTimeout("top.hideTab();", 30);
      return;
   }

   var thisClass  = new String(document.thisItem.getProperty("classification",""));
   var tabbar = parent.relationships.relTabbar;

   if (thisClass != "/Part/Assembly" )
   {
      tabid = tabbar.GetTabId("BOM");
      tabbar.SetTabVisible(tabid,false);
   }
};

setTimeout("top.hideTab();", 30);