Example Placeholder Queries

You can use the following example placeholder queries as a guide as you enter your queries yourself, instead of using form items to build your query.

You can use queries like these when you are configuring Advanced Form Search controls, Object Lookup controls, organization-defined searches, or Find Similar buttons.

  • nickname:PLACEHOLDER(nickname)
    The value nickname is a placeholder of type text box.

    On the control, if the user types al into the text box, the following query runs:

    nickname:al
  • create_at_dttm:>=DATECALC(FIELDVALUE (created_at_dttm,"NOW()"),-7,days,YYYY-MM-DD)
    In this example, today’s date is 8th March 2019, and created_at_dttm specifies 15th January 2019. The created_at_dttm field is not empty, so the fallback date of today is not used.

    The following query runs:

    created_at_dttm:>=2018-01-08
  • event_date:PLACEHOLDER(eventdate)
    The value eventdate is a placeholder of type date. The offset start value is -5 and the offset end value is +5. Today is 15th May 2019.

    On the control, the date range is displayed like this:

    From: 10th May 2019

    To: 20th May 2019

    The following query runs:

    event_date:[2019-05-10 TO 2019-05-20]
  • nickname:PLACEHOLDER(category)
    The value category is a placeholder of type drop-down list.

    On the control, if the user selects Assault from the drop-down list, the following query runs (the reference list code for Assault is 2):

    category.code:2
  • created_by_user_id:VALUEOF(username)
    The logged in user name is harrym5.

    The following query runs:

    created_by_user_id:harrym5
  • employee_name.userId:FIELDVALUE(reporting_officer)
    This example sets the employee_name field to the user name that is specified in the reporting_officer user group chooser control.
  • group_membership.groupId:FIELDVALUE(managing_group)
    This example sets the group_membership field to the group name that is specified in the managing_group user group chooser control.
  • text:FIELDVALUE(description)
    In this example, if the description source field is blank, then the default query placeholder is used.

    The following query runs:

    text:""
  • text:FIELDVALUE(description, "*")
    In this example, if the description source field is blank and a default value is explicitly supplied in the function, then the supplied default is used.

    The following query runs:

    text:*
  • This example describes how queries handle optional placeholders:

    first_name:PLACEHOLDER(first_name,"*") AND last_name:PLACEHOLDER(last_name,"*")

    If the user enters Smith in the Last name field and enters no value in the First name field, the following query is generated:

    first_name:* AND last_name:Smith

    The blank value has been converted to an asterisk (*). For wildcard characters, OpenSearch returns only fields that contain values and excludes blank fields. The implication of this outcome is that the query returns the following object:

    • First name: Robert
    • Last name: Smith

    The search does not return the following object:

    • First name:
    • Last name: Smith

    The PLACEHOLDER method can take a default value, which is used when the field is blank. The following query can be used with a fielded search to return blank values:

    exists OR (_exists_:_type)

    For example:

    first_name:PLACEHOLDER(first_name,"exists OR (_exists_:_type)") AND last_name:PLACEHOLDER(last_name, "exists OR (_exists_:_type)")

    If the user enters Smith in the Last name field and enters no value in the First name field, the search returns the following object:

    • First name:
    • Last name: Smith

    For text fields, a default value "" works with the current version of OpenSearch. The following is an example placeholder search that uses this syntax:

    first_name:PLACEHOLDER(first_name,"""") AND last_name:PLACEHOLDER(last_name, """")

    OpenSearch removes the fielded part of the query when it encounters "". The following query runs if the First name field is empty and the Last name field value is Smith:

    last_name:Smith

    When you are working with PLACEHOLDER searches, the following limitations apply:

    • A default query of "" does not work for Reference Lists or Date fields.
    • You should test both the query that is produced by a placeholder search and the results.
    • If all placeholder fields are configured to be mandatory, then optional placeholders cannot occur because the query cannot be run with blank fields.
    • If the PLACEHOLDER function does not supply a default value and it is applied to a Text field, then the query uses the global default search placeholder. For more information, see Set the Default Search Placeholder.
Last updated: October 9, 2026