Skip to content

Commit

Permalink
fix isValid parameter in query dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
gmansueto committed Apr 6, 2023
1 parent 8c76809 commit f2fad02
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions chapter_3/create_dataset/query.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ It is also possible to dynamically change the original text of the query at runt

Script editing for dataset.

In Code Query dataset’s script example we uses JavaScript to dynamically modify the ``FROM`` clause of the original query according to the value of the parameter year selected at runtime by the user. You can notice that the variable ``query``, provided by Knowage, contains the text of the SQL query.
In the script below we use JavaScript to dynamically modify the ``FROM`` clause of the original query according to the value of the parameter *year* selected at runtime by the user. You can notice that the variable ``query``, provided by Knowage, contains the text of the SQL query.

.. code-block:: javascript
:caption: Query dataset’s script example query
:caption: Example of a script in a *Query* dataset
:linenos:
if( parameters.get('year') == 1997 ) {
if( isValid('year') == 1997 ) {
query = query.replace('FROM sales_fact_1998', 'FROM sales_fact_1997');
} else {
query = query; // do nothing
Expand Down

0 comments on commit f2fad02

Please sign in to comment.