Using query variables, you can link to screens with context

When you configure a link from one screen to another in Fliplet, you can add query variables. Query variables let you provide additional settings to the way the destination screen is opened e.g. go to the Contact Directory screen, with a filter enabled the “Company” field

When should I use query variables?

Query variables can be used in two scenarios:

  1. Navigating to a screen with query variables for special components, e.g. directories>
  2. Navigating to a screen with query variables for custom developed features

Currently, only the directory feature supports query variables (see bottom of this article). Other uses of query variables would need to be custom coded.

How to specify query variables?

Query variables are set like standard GET parameters on standard web pages.

For example:

?action=filter&field=Company

This sets variable action  as filter  and field  as Company  when users land on the destination screen. Note that multiple variables are separated by &s and each variable is assigned with the =  character.

Note that characters on either side of the = character will need to be URLEncoded like standard  GET parameters on webpages. This means an apostrophe character like 'will be translated into %27.

If you are using query parameters in custom JavaScript you can use encodeURIComponent to do the encoding for you. This is especially needed if you use query parameters without proper encoding it can cause an iOS app to freeze.
For example:

?action=encodeURIComponent(filter)&field=encodeURIComponent(Company)

How to read from query variables?

Once the user is navigated to a  destination screen, developers can use the 

Fliplet.Navigate.query

To find the query variables parsed into a JSON object.

Fliplet.Navigate.query

Would only be available after the

Fliplet.Navigator.onReady()

Promise has been resolved.

Example:

Fliplet.Navigator.onReady().then(function () { // Fliplet.Navigate.query would be accessible here as a JSON object })

How to use query variables with directories?

Open the directory in search  mode<

?action=search

Open  the  directory  with a specific search keyword

?action=search&value=key%20word

Open the directory with a  specific entry

?action=search&value=John%20Appleseed

This is the same as the previous scenario because if a preset search returns only one result, the entry will be opened.

Open the  directory in  filter mode

?action=filter

Open the directory with filter  mode activated on a specific field

?action=filter&field=Company

Open the directory with filter mode activated on a specific field and value

?action=filter&field=Company&value=ABC%20Corp

 

Was this article helpful?
YesNo