Personalizing Default Values for Filter Controls


You can personalize default values for filters in a page based on users or conditions. This feature uses the amper (&&) global variable to specify the default option for a filter control. For example, you can set the Region value for a user, using the && global variable, and link it to the filter control to show their region as the selected value.

Procedure: How to Personalize Default Values for Filter Controls

  1. Start by creating a FOCEXEC which specifies the global variable and the default values. In this example, we are setting default values for different users for the Region control.
    1. On the Home Page, in the Action bar, click the Other tab, and then click Text Editor.
      The New Text Resource dialog box opens.
    2. Click FOCEXEC.
      The new Text file opens.
    3. Add the following FOCEXEC code to set the global variable:

      - &&DEFREGION
      -SET &&DEFREGION= IF &FOCSECUSER EQ user1 THEN 'North America' ELSE
      -IF &FOCSECUSER EQ user2  THEN 'EMEA' ELSE  'South America';
       
    4. Save your changes and close the Text Editor.
    5. Publish the FOCEXEC.
       
  2. Bring the global variable in effect by either running the FOCEXEC or mapping its path in the Administration Console for it to be run when the user signs in.

    To map the FOCEXEC you just created in the Administration console, add the FOCEXEC path to the Paths to be executed on user Sign-in field in the Other section under Application Settings. The FOCEXEC path name can be copied from the Properties panel in the Home page.

    Note: If you are setting the FOCEXEC to be executed on sign in, make sure that the WebFOCUS user credentials are passed to the server. One way to do that is to set the server connection to Trusted and select the Pass WebFOCUS User ID and other Groups radio button. For more information on how to use the Administration Console, see the WebFOCUS Security and Administration technical content.
     
  3. Create a Designer page, as described in Creating Pages in WebFOCUS Designer
     
  4. Populate your new page with the content that features the Region parameter and add the Region filter to the canvas, as described in Adding Filters to the Page.
     
  5. Click the Region filter, open the Properties panel and, in the Settings tab, under Data Settings, type the default value variable that you created in the FOCEXEC (in this case, &&DEFREGION).
    The following image shows an example of the Default value property populated with the variable.


     
  6. Save, publish, and run your page.
    The default value for the Region filter control is North America, as shown in the following image.

  7. Sign in to WebFOCUS as one of the users mentioned in the FOCEXEC.

  8. Run the same page.
    The following image shows an example of the user with the username user1 running the page. The default Region value now is EMEA.