Skip to content

Commit d4fa690

Browse files
[docs:] Update information on getter functions for RunJS and RunPy docs (ToolJet#9340)
* update information on getter functions * update the code for getter functions
1 parent 72fa067 commit d4fa690

File tree

10 files changed

+92
-103
lines changed

10 files changed

+92
-103
lines changed

docs/docs/data-sources/run-py.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,44 +53,38 @@ queries.getSalesData.run()
5353

5454
To immediately access the data returned by a query in **Run Python code**, you can use the below functions:
5555

56-
#### Retrieve the latest data of a query:
56+
#### Trigger a query and retrieve its data:
5757
```py
58-
response = await queries.getSalesData.run()
58+
await queries.getSalesData.run()
5959
#replace getSalesData with your query name
6060

6161
value = queries.getSalesData.getData()
6262
#replace getSalesData with your query name
63-
64-
value
6563
```
6664

67-
#### Retrieve the latest raw data of a query:
65+
#### Trigger a query and retrieve its raw data:
6866
```py
69-
response = await queries.getCustomerData.run()
67+
await queries.getCustomerData.run()
7068
#replace getCustomerData with your query name
7169

7270
value = queries.getCustomerData.getRawData()
7371
#replace getCustomerData with your query name
74-
75-
value
7672
```
7773

78-
#### Retrieve the loading state of a query:
74+
#### Trigger a query and retrieve its loading state:
7975
```py
80-
response = await queries.getTodos.run()
76+
await queries.getTodos.run()
8177
#replace getTodos with your query name
8278

8379
value = queries.getTodos.getLoadingState()
8480
#replace getTodos with your query name
85-
86-
value
8781
```
8882

8983
## Get Variables
9084

91-
To immediately access a variable or page variable after setting it in the **Run Python code**, you can use the below functions.
85+
To immediately access a variable or page variable after setting it in the **Run Python code**, you can use the below functions:
9286

93-
#### Retrieve the current value of a variable:
87+
#### Set and retrieve a variable:
9488
```py
9589
actions.setVariable('mode','dark')
9690
#replace mode with your desired variable name
@@ -99,7 +93,7 @@ actions.getVariable('mode')
9993
#replace mode with your desired variable name
10094
```
10195

102-
#### Retrieve the current value of a page-specific variable:
96+
#### Set and retrieve a page-specific variable:
10397
```py
10498
actions.setPageVariable('number',1)
10599
#replace number with your desired variable name

docs/docs/how-to/run-action-from-runjs.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,30 @@ In the screenshot below, we are triggering two different queries using two diffe
3737

3838
In the previous section, we saw how we can trigger queries. Once the queries are triggered, if you want to immediately use the data returned by the query inside the RunJS query, you can use the `getData()`, `getRawData()` and `getLoadingState()` functions:
3939

40-
#### Retrieve the latest data of a query:
40+
#### Trigger a query and retrieve its data:
4141

4242
```js
43+
await queries.getSalesData.run();
44+
// replace getSalesData with your query name
45+
4346
let value = queries.getSalesData.getData();
4447
// replace getSalesData with your query name
4548
```
4649

47-
#### Retrieve the latest raw data of a query:
50+
#### Trigger a query and retrieve its raw data:
4851

4952
```js
50-
let response = await queries.getCustomerData.run();
53+
await queries.getCustomerData.run();
5154
//replace getCustomerData with your query name
5255

5356
let value = queries.getCustomerData.getRawData();
5457
// replace getCustomerData your with query name
5558
```
5659

57-
#### Retreive the loading state of a query:
60+
#### Trigger a query and retrieve its loading state:
5861

5962
```js
60-
let response = await queries.getTodos.run()
63+
await queries.getTodos.run()
6164
//replace getTodos with your query name
6265

6366
let value = queries.getTodos.getLoadingState();
@@ -96,9 +99,9 @@ actions.unSetVariable('<variableName>')
9699

97100
### Get Variables
98101

99-
To access variables through immediately after setting them in a RunJS query, you can use the below `getVariable` and `getPageVariable` functions:
102+
To access variables immediately after setting them in a RunJS query, you can use the `getVariable` and `getPageVariable` functions:
100103

101-
#### Retrieve the current value of a variable:
104+
#### Set and retrieve a variable:
102105

103106
```js
104107
actions.setVariable('mode','dark');
@@ -107,7 +110,7 @@ actions.setVariable('mode','dark');
107110
return actions.getVariable('mode');
108111
```
109112

110-
#### Retrieve the current value of a page-specific variable:
113+
#### Set and retrieve a page-specific variable:
111114
```js
112115
actions.setPageVariable('number',1);
113116
//replace number with your desired variable name

docs/versioned_docs/version-2.29.0/data-sources/run-py.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,11 @@ value
6666

6767
#### Retrieve the latest raw data of a query:
6868
```py
69-
response = await queries.getCustomerData.run()
69+
await queries.getCustomerData.run()
7070
#replace getCustomerData with your query name
7171

7272
value = queries.getCustomerData.getRawData()
7373
#replace getCustomerData with your query name
74-
75-
value
7674
```
7775

7876
#### Retrieve the loading state of a query:

docs/versioned_docs/version-2.29.0/how-to/run-action-from-runjs.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,30 @@ In the screenshot below, we are triggering two different queries using two diffe
3737

3838
In the previous section, we saw how we can trigger queries. Once the queries are triggered, if you want to immediately use the data returned by the query inside the RunJS query, you can use the `getData()`, `getRawData()` and `getLoadingState()` functions:
3939

40-
#### Retrieve the latest data of a query:
40+
#### Trigger a query and retrieve its data:
4141

4242
```js
43+
await queries.getSalesData.run();
44+
// replace getSalesData with your query name
45+
4346
let value = queries.getSalesData.getData();
4447
// replace getSalesData with your query name
4548
```
4649

47-
#### Retrieve the latest raw data of a query:
50+
#### Trigger a query and retrieve its raw data:
4851

4952
```js
50-
let response = await queries.getCustomerData.run();
53+
await queries.getCustomerData.run();
5154
//replace getCustomerData with your query name
5255

5356
let value = queries.getCustomerData.getRawData();
5457
// replace getCustomerData your with query name
5558
```
5659

57-
#### Retreive the loading state of a query:
60+
#### Trigger a query and retrieve its loading state:
5861

5962
```js
60-
let response = await queries.getTodos.run()
63+
await queries.getTodos.run()
6164
//replace getTodos with your query name
6265

6366
let value = queries.getTodos.getLoadingState();
@@ -96,9 +99,9 @@ actions.unSetVariable('<variableName>')
9699

97100
### Get Variables
98101

99-
To access variables through immediately after setting them in a RunJS query, you can use the below `getVariable` and `getPageVariable` functions:
102+
To access variables immediately after setting them in a RunJS query, you can use the `getVariable` and `getPageVariable` functions:
100103

101-
#### Retrieve the current value of a variable:
104+
#### Set and retrieve a variable:
102105

103106
```js
104107
actions.setVariable('mode','dark');
@@ -107,7 +110,7 @@ actions.setVariable('mode','dark');
107110
return actions.getVariable('mode');
108111
```
109112

110-
#### Retrieve the current value of a page-specific variable:
113+
#### Set and retrieve a page-specific variable:
111114
```js
112115
actions.setPageVariable('number',1);
113116
//replace number with your desired variable name

docs/versioned_docs/version-2.30.0/data-sources/run-py.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,44 +53,38 @@ queries.getSalesData.run()
5353

5454
To immediately access the data returned by a query in **Run Python code**, you can use the below functions:
5555

56-
#### Retrieve the latest data of a query:
56+
#### Trigger a query and retrieve its data:
5757
```py
58-
response = await queries.getSalesData.run()
58+
await queries.getSalesData.run()
5959
#replace getSalesData with your query name
6060

6161
value = queries.getSalesData.getData()
6262
#replace getSalesData with your query name
63-
64-
value
6563
```
6664

67-
#### Retrieve the latest raw data of a query:
65+
#### Trigger a query and retrieve its raw data:
6866
```py
69-
response = await queries.getCustomerData.run()
67+
await queries.getCustomerData.run()
7068
#replace getCustomerData with your query name
7169

7270
value = queries.getCustomerData.getRawData()
7371
#replace getCustomerData with your query name
74-
75-
value
7672
```
7773

78-
#### Retrieve the loading state of a query:
74+
#### Trigger a query and retrieve its loading state:
7975
```py
80-
response = await queries.getTodos.run()
76+
await queries.getTodos.run()
8177
#replace getTodos with your query name
8278

8379
value = queries.getTodos.getLoadingState()
8480
#replace getTodos with your query name
85-
86-
value
8781
```
8882

8983
## Get Variables
9084

91-
To immediately access a variable or page variable after setting it in the **Run Python code**, you can use the below functions.
85+
To immediately access a variable or page variable after setting it in the **Run Python code**, you can use the below functions:
9286

93-
#### Retrieve the current value of a variable:
87+
#### Set and retrieve a variable:
9488
```py
9589
actions.setVariable('mode','dark')
9690
#replace mode with your desired variable name
@@ -99,7 +93,7 @@ actions.getVariable('mode')
9993
#replace mode with your desired variable name
10094
```
10195

102-
#### Retrieve the current value of a page-specific variable:
96+
#### Set and retrieve a page-specific variable:
10397
```py
10498
actions.setPageVariable('number',1)
10599
#replace number with your desired variable name

docs/versioned_docs/version-2.30.0/how-to/run-action-from-runjs.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,30 @@ In the screenshot below, we are triggering two different queries using two diffe
3737

3838
In the previous section, we saw how we can trigger queries. Once the queries are triggered, if you want to immediately use the data returned by the query inside the RunJS query, you can use the `getData()`, `getRawData()` and `getLoadingState()` functions:
3939

40-
#### Retrieve the latest data of a query:
40+
#### Trigger a query and retrieve its data:
4141

4242
```js
43+
await queries.getSalesData.run();
44+
// replace getSalesData with your query name
45+
4346
let value = queries.getSalesData.getData();
4447
// replace getSalesData with your query name
4548
```
4649

47-
#### Retrieve the latest raw data of a query:
50+
#### Trigger a query and retrieve its raw data:
4851

4952
```js
50-
let response = await queries.getCustomerData.run();
53+
await queries.getCustomerData.run();
5154
//replace getCustomerData with your query name
5255

5356
let value = queries.getCustomerData.getRawData();
5457
// replace getCustomerData your with query name
5558
```
5659

57-
#### Retreive the loading state of a query:
60+
#### Trigger a query and retrieve its loading state:
5861

5962
```js
60-
let response = await queries.getTodos.run()
63+
await queries.getTodos.run()
6164
//replace getTodos with your query name
6265

6366
let value = queries.getTodos.getLoadingState();
@@ -96,9 +99,9 @@ actions.unSetVariable('<variableName>')
9699

97100
### Get Variables
98101

99-
To access variables through immediately after setting them in a RunJS query, you can use the below `getVariable` and `getPageVariable` functions:
102+
To access variables immediately after setting them in a RunJS query, you can use the `getVariable` and `getPageVariable` functions:
100103

101-
#### Retrieve the current value of a variable:
104+
#### Set and retrieve a variable:
102105

103106
```js
104107
actions.setVariable('mode','dark');
@@ -107,7 +110,7 @@ actions.setVariable('mode','dark');
107110
return actions.getVariable('mode');
108111
```
109112

110-
#### Retrieve the current value of a page-specific variable:
113+
#### Set and retrieve a page-specific variable:
111114
```js
112115
actions.setPageVariable('number',1);
113116
//replace number with your desired variable name

docs/versioned_docs/version-2.33.0/data-sources/run-py.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,44 +53,38 @@ queries.getSalesData.run()
5353

5454
To immediately access the data returned by a query in **Run Python code**, you can use the below functions:
5555

56-
#### Retrieve the latest data of a query:
56+
#### Trigger a query and retrieve its data:
5757
```py
58-
response = await queries.getSalesData.run()
58+
await queries.getSalesData.run()
5959
#replace getSalesData with your query name
6060

6161
value = queries.getSalesData.getData()
6262
#replace getSalesData with your query name
63-
64-
value
6563
```
6664

67-
#### Retrieve the latest raw data of a query:
65+
#### Trigger a query and retrieve its raw data:
6866
```py
69-
response = await queries.getCustomerData.run()
67+
await queries.getCustomerData.run()
7068
#replace getCustomerData with your query name
7169

7270
value = queries.getCustomerData.getRawData()
7371
#replace getCustomerData with your query name
74-
75-
value
7672
```
7773

78-
#### Retrieve the loading state of a query:
74+
#### Trigger a query and retrieve its loading state:
7975
```py
80-
response = await queries.getTodos.run()
76+
await queries.getTodos.run()
8177
#replace getTodos with your query name
8278

8379
value = queries.getTodos.getLoadingState()
8480
#replace getTodos with your query name
85-
86-
value
8781
```
8882

8983
## Get Variables
9084

91-
To immediately access a variable or page variable after setting it in the **Run Python code**, you can use the below functions.
85+
To immediately access a variable or page variable after setting it in the **Run Python code**, you can use the below functions:
9286

93-
#### Retrieve the current value of a variable:
87+
#### Set and retrieve a variable:
9488
```py
9589
actions.setVariable('mode','dark')
9690
#replace mode with your desired variable name
@@ -99,7 +93,7 @@ actions.getVariable('mode')
9993
#replace mode with your desired variable name
10094
```
10195

102-
#### Retrieve the current value of a page-specific variable:
96+
#### Set and retrieve a page-specific variable:
10397
```py
10498
actions.setPageVariable('number',1)
10599
#replace number with your desired variable name

0 commit comments

Comments
 (0)