Creating static selections

You can create static selections so that users can use the saved search queries and results. When users choose a static selection, they get the same search results every time they run the selection. Static selections are useful for storing a specific query result that you want to store as it is. For examples, you might want create a selection to store the sales results of cars for March.

Before you begin

Ensure that you know what results that you want returned from the static selection.

Procedure

  1. Create the selection. Use any one of the following methods: user interface, Java™ API, or script API.
    Option Description
    User interface
    1. Click Product Manager > Catalogs > Catalog Console..
    2. Choose a catalog.
    3. Click Rich Search.
    4. Provide the required details.
    5. From the Save search as field, select Static Selection.
    6. Provide a name for the selection.
    7. Provide the search criteria.
    8. Click Search.
    Java API The following sample Java API code creates a static selection.
    Context ctx = PIMContextFactory.getCurrentContext();
    SelectionManager mgr = ctx.getSelectionmanager();
    Catalog ctg = ctx.getCatalogManager().getCatalog("my catalog");
    Hierarchy ctr = ctx.getHierarchyManager().getCatalog("my hierarchy");
    StaticSelection sel = mgr.createStaticSelection(ctg, ctr, "my static selection");
    sel.save();
    Script API The following sample script creates a static selection.
    var ctg = getCtgByName("my catalog");
    		var sel = new BasicSelection(ctg, "my static selection");
    		var item = ctg.getCtgItemByPrimaryKey("pk1");
    		sel.addEntryToSelection(item);
    		sel.saveSelection();
    Note: From the script API, when the development team deprecates BasicSelection and if the new StaticSelection script op exists then change var sel = new BasicSelection to var sel = new StaticSelection.
    The selection is created, users can view it in the Selection console.
  2. Optional: Run the static selection.