Overview
The JS API provides two means for setting up Guided NLQ:
- via the Advanced API; and
- via the embed link (discussed below).
The most flexible choice is the Advanced API, which provides full flexibility in what you display and how to use the details returned from triggered events. For example, if a user saves their question results as a report, all the functions associated with the Report API become available for that report.
In contrast, using the embed link provides a simple and less flexible means of embedding Guided NLQ. The embed link is a query string with parameters that provide the display options when passed as part of a URL. There are no event-based options with the embedded link toolset.
Set up Guided NLQ via the embed link
The embed link is a massively simplified version of the Guided NLQ Advanced API. It will not allow developers to use events. It will simply render based on which parameters are added in the URL.
The basic structure of a Guided NLQ embed link is:
<script src=”http://localhost:8080/JsAPI/v3?nlq=true”></script>
This will place the nlq container onto the page — in the same place that the script tag itself has been added.
There are a number of extra parameters that can be added to the embed URL. For more details on what each one does, see the entry in the Advanced API page, as all of these options are pass-through configurations for the Advanced API.
popup
This query string parameter determines if the Guided NLQ UI should render in a lightbox or not. If the parameter is excluded from the query string, the default behavior is false.
http://localhost:8080/JsAPI/v3?nlq=true&popup=true
http://localhost:8080/JsAPI/v3?nlq=true&popup=false
viewUUID
If the viewUUID parameter is included in the query string, the step to select a view is skipped, and the interface immediately moves onto the Ask a Question phase. If the parameter is excluded from the query string, the usual dialog box to select a data view will be displayed.
http://localhost:8080/JsAPI/v3?nlq=true&viewUUID=8862563a-02a5-4caf-9352-237b9e40c0de
showWelcome
This query string parameter determines whether or not to show the Guided NLQ Welcome splash screen.
http://localhost:8080/JsAPI/v3?nlq=true&showWelcome=ALWAYS
http://localhost:8080/JsAPI/v3?nlq=true&showWelcome=NEVER
http://localhost:8080/JsAPI/v3?nlq=true&showWelcome=NORMAL
showSave
This query string parameter determines whether to show or hide the Save button for the NLQ UI, if the user has access to save the content. If the user doesn’t have access to save, the button won’t be displayed regardless of how this parameter is set. If the parameter is excluded from the query string, the default behavior is true.
http://localhost:8080/JsAPI/v3?nlq=true&showSave=true
Is effectively the same as doing this in the advanced API:
yellowfin.loadNLQ({ contentIntegrationOptions: { controls: [‘SAVE’] } });
If false were passed, it would become:
yellowfin.loadNLQ({ contentIntegrationOptions: { controls: [] } });
showAddTo
This query string parameter determines whether to show or hide the Add To button (to add reports to other content) for the Guided NLQ UI, if the user has access to it. If the user doesn’t have access to add reports to other content, the button won’t be displayed regardless of how this parameter is set.
If the parameter is excluded from the query string, the default behavior is false. If this parameter is set to true, the showSave parameter must either be excluded from the query string or set to true.
http://localhost:8080/JsAPI/v3?nlq=true&showSave=true&showAddTo=true
OR
http://localhost:8080/JsAPI/v3?nlq=true&showAddTo=true
Effectively this is the same as the following Advanced API call:
yellowfin.loadNLQ({ contentIntegrationOptions: { controls: [‘SAVE’, ‘ADD_TO’] } });