Use Case: Dashboard With Global Search

Overview

Your dashboard is only useful if it's easy to navigate. You may find that navigation becomes more difficult as more submissions appear on your dashboard. Adding search functionality can help.

What is Global Search?

Global search lets you search many submission fields at once using a single search bar. When you enter a search term, only submissions that contain your search term show in the dashboard.

Let’s say you have a dashboard that lists the following data for each submission:

  • First Name

  • Middle Name

  • Last Name

  • Email

  • Date of Birth

Most often, you'll find submissions based on their Last Name or Email fields. To do this faster, you can set up a global search that references those two fields at once.

This use case also includes steps for building a simple dashboard. The dashboard pulls submissions from the following source module: https://trainingx.unqork.io/#/display/5eb01aa6811bf80215fd706b. If you're following along from the Simple Dashboard article, you can skip pre-configuration.

Here's how your completed dashboard will look in Express View:

Here's how your completed dashboard will look in the Module Builder:

What You’ll Learn

In this article, you’ll learn how to set up a global search to reference specific fields in your dashboard.

What You’ll Need

To set up this use case, you’ll need:

  • 1 Panel component

  • 1 Initializer component

  • 2 Hidden components

  • 1 Plug-In component

  • 1 ViewGrid component

  • 1 Decisions component

  • 1 Submission Search template

The Submission Search template includes the following:

  • 1 Text Field component

  • 3 Hidden components

  • 1 Data Workflow component

  • 1 Calculator component

  • 1 Initializer component

  • 1 Plug-In component

Pre-Configuration

To build the above dashboard, continue as follows:

Configure the Submission Search Template

Next, let's add the Submission Search template to your dashboard module. This template sets up your global search functionality, with a few adjustments. You can locate the Submission Search template by searching under Templates in the Module Builder.

1. In the Module Builder, drag and drop a Submission Search template onto your canvas. Place your template above your panelDashboard Panel.
2. Delete the moduleId Hidden component from the panelSubmissionSearch Panel.
3. Delete the pluginGetSubmissions Plug-In from the panelSubmissionSearch Panel.

NOTE  The Submission Search template includes a moduleId Hidden component and a pluginGetSubmissions Plug-In component. Because you already set these components up during pre-configuration, you can delete them from the template.

4. Save your module.

Update the Data Workflow Component

Next, we’ll update the Data Workflow component in the template to reference your chosen search parameter fields.

1. Hover over the dwSearchGlobalData Workflow component.

A 5-button toolbar appears above the component on hover-over.

2. Using the toolbar, click the (Settings) button.
3. Click on the Create Field operator to open its Info window.

NOTE  Fields 1 and 2 already show the following formulas: CONCATENATE('{"data.PROPERTYNAMEONE":"/', _arg, '/i"}') and CONCATENATE('{"data.PROPERTYNAMETWO":"/', _arg, '/i"}'). PROPERTYNAMEONE and PROPERTYNAMETWO are the placeholders for the search parameter fields you’ll be referencing.

4. In Field 1, replace PROPERTYNAMEONE with email.

NOTE  The Property Name you enter here must match what’s listed in the ID column of the Inputs table in your pluginGetSubmissions Plug-In. This ties the search to the Email field of your dashboard.

5. In Field 2, replace PROPERTYNAMETWO with lastName.

NOTE  The Property Name you enter here must match what’s listed in the ID column of the Inputs table in your pluginGetSubmissions Plug-In. This ties the search to the Last Name field of your dashboard.

6. Click the Save button.
7. Save your module.

NOTE   Sometimes, you may want more than two search parameters in your global search. To reference more than two fields, enter the formula again in Fields 3–5 of the Create Field operator. Increase the sequence for each and replace PROPERTYNAME as needed. The resulting Info window will look like this:

Setting

Selection

Category

Formula

Label

Leave this blank.

Do Not Sanitize Formula

YES (checked)

Field 1

0 = CONCATENATE('{"data.PROPERTYNAMEONE":"/', _arg, '/i"}')

Field 2

1 = CONCATENATE('{"data.PROPERTYNAMETWO":"/', _arg, '/i"}')

Field 3

2 = CONCATENATE('{"data.PROPERTYNAMETHREE":"/', _arg, '/i"}')

Field 4

3 = CONCATENATE('{"data.PROPERTYNAMEFOUR":"/', _arg, '/i"}')

Field 5

4 = CONCATENATE('{"data.PROPERTYNAMEFIVE":"/', _arg, '/i"}')

To reference more than five fields, add another Create Field operator to the workflow. Then, continue the formula sequence. The resulting Info window will look like this:

Setting

Selection

Category

Formula

Label

Leave this blank.

Do Not Sanitize Formula

YES (Checked)

1

5 = CONCATENATE('{"data.PROPERTYNAMESIX":"/', _arg, '/i"}')

2

6 = CONCATENATE('{"data.PROPERTYNAMESEVEN":"/', _arg, '/i"}')

3

7 = CONCATENATE('{"data.PROPERTYNAMEEIGHT":"/', _arg, '/i"}')

4

8 = CONCATENATE('{"data.PROPERTYNAMENINE":"/', _arg, '/i"}')

5

9 = CONCATENATE('{"data.PROPERTYNAMETEN":"/', _arg, '/i"}')

Update the Text Field Component

Next, you'll update the Text Field component masterSearchGlobal. As configured in the template, it includes placeholder text that doesn't match this configuration. The placeholder text tells end-users what search parameters they can use. You'll update it to direct users to search by email or last name.

1. Hover over the masterSearchGlobal Text Field component.

A 5-button toolbar appears above the component on hover-over.

2. Using the toolbar, click the (Settings) button.
3. Enter Search by email or last name in the Placeholder field.

4. Click Save.

Update the Plug-In Component

In order to add the search functionality to the dashboard, you'll update your pluginGetSubmissions Plug-In component.

1. Hover over the pluginGetSubmissions Plug-In component.

A 5-button toolbar appears above the component on hover-over.

2. Using the toolbar, click the (Settings) button.
3. Enter /fbu/uapi/system/getSubmissions?{{data.searchGlobalFilterOr}} in the Data Source URL.

4. Click Save.
5. Save your module.

Summary

With this complete, your dashboard now has a search bar referencing the Last Name and Email fields. You can preview your dashboard in Express View and test the functionality.

Lab