Built-in Functions → startsWith

startsWith() is a boolean function that returns true if a field expression starts with any of the specified string(s), find1, find2,..., otherwise, it returns false.

Note

The startswith() function is not case sensitive.

Signature

startsWith(field exp, find1, find2, ...)

The following table illustrates the startsWith() boolean function parameters:

ParameterDescription
field expThe input field
find1, find2, ...The string value(s) to find if the field exp starts with

Returns

boolean

Example

Find all countries that start with the a, d, or n characters.

startsWith(
SALES.COUNTRIES.COUNTRY_NAME,
"a",
"d",
"n"
)

Use the following steps for detailed instructions on how to use the startsWith() boolean function:

Note

In the Cluster Management Console (CMC), you can create a tenant that includes Sample Data. The Sample Data includes the SALES schema.

  • In the Navigation bar, select the Content tab, and then select + New → Add Dashboard.
  • In the Add Dashboard dialog, for Name, enter Product Dashboard, and then select Add.
  • In the Action bar, select + (add icon), or select + Add Insight.
  • In the Insight panel, select Listing Table or V.
  • In Tables, select Aggregated Table.
  • In the Data panel, select Manage Dataset.
  • In the Manage Data Sets panel, in Tables, select SALES. Close the panel.
  • From the Data panel, drag and drop the following columns to the respective tray:
    • Country from the COUNTRIES table to the Grouping Dimension tray
    • Revenue from the SALES table to the Measure tray
      • In the Properties panel, for Number Format, select Dollar Rounded.
  • From the Data panel, drag and drop Add Formula to the Grouping Dimension tray.
  • The Formula Builder automatically opens:
    • In Search Functions, select the down arrow, and then select Boolean Functions.
    • Double-click the startsWith function, startsWith(field exp, find1, find2, ...), to add the formula to the editor.
    • In the Formula Editor,
      • Replace field exp with Country from the Data panel
      • Replace find1 with “a”
      • Replace find2 with “d”
      • Replace ... with “n”
startsWith(SALES.COUNTRIES.COUNTRY_NAME,"a","d","n")
  • Select Validate & Save.
  • In the Properties panel, for Column Label, enter startsWith()
  • Name the insight Revenue Per Country.
  • In the Action bar, select Save.