Using Attributes

The following example uses attributes for a folder to determine what is displayed to an end-user. The end-user still has access to the content, however, it isn't displayed. This program doesn't discuss how to hide or display content: it just shows the function used to determine if a folder should be displayed.

The following is the complete code sample: the steps explain each line.

Function checkVisible(&FolderId As ApiObject) Returns Boolean 
   &colAttrib = &FolderId.Attributes;
   If &colAttrib.ItemByName("PORTAL_HIDE_FROM_NAV") <> Null Then
      If &colAttrib.ItemByName("PORTAL_HIDE_FROM_NAV").value = "TRUE" Then
             &display = False;
      End-If;
   End-If;

    Return &display;

End-Function;

To use attributes for a folder:

  1. Access the folder attribute collection.

    A reference to a folder is passed into the function. Then the example uses the Attributes property on the folder to access the attribute collection for the folder.

    &colAttrib = &FolderId.Attributes;
  2. Check to see if the folder should be hidden.

    This step is actually two checks. The first check is to see if there is an attribute with the folder called PORTAL_HIDE_FROM_NAV. If the folder has such an attribute, the second check determines the value of this attribute. If both are true, the folder should be hidden, so the variable &display is set to True, and returned.

    If &colAttrib.ItemByName("PORTAL_HIDE_FROM_NAV") <> Null Then
          If &colAttrib.ItemByName("PORTAL_HIDE_FROM_NAV").value = "TRUE" Then
                 &display = False;
          End-If;
       End-If;
    
        Return &display;