Skip to content

Commit

Permalink
Merge pull request #9655 from ToolJet/docs/update-python-doc
Browse files Browse the repository at this point in the history
[docs]: Update RunPy doc
  • Loading branch information
adishM98 committed May 8, 2024
2 parents 9423e89 + b05d794 commit 712800e
Show file tree
Hide file tree
Showing 10 changed files with 209 additions and 21 deletions.
30 changes: 27 additions & 3 deletions docs/docs/data-sources/run-py.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ await queries.getSalesData.run()

value = queries.getSalesData.getData()
#replace getSalesData with your query name

value
```

#### Trigger a query and retrieve its raw data:
Expand All @@ -69,6 +71,8 @@ await queries.getCustomerData.run()

value = queries.getCustomerData.getRawData()
#replace getCustomerData with your query name

value
```

#### Trigger a query and retrieve its loading state:
Expand All @@ -78,13 +82,21 @@ await queries.getTodos.run()

value = queries.getTodos.getLoadingState()
#replace getTodos with your query name

value
```

## Get Variables

To immediately access a variable or page variable after setting it in the **Run Python code**, you can use the below functions:
To set and access variables or page variables in **Run Python code**, you can use the below functions:

#### Set a variable:
```py
actions.setVariable('color','blue')
#replace color with your desired variable name
```

#### Set and retrieve a variable:
#### Immediately retrieve a variable after setting it:
```py
actions.setVariable('mode','dark')
#replace mode with your desired variable name
Expand All @@ -93,7 +105,13 @@ actions.getVariable('mode')
#replace mode with your desired variable name
```

#### Set and retrieve a page-specific variable:
#### Set a page-specific variable:
```py
actions.setPageVariable('version',1)
#replace version with your desired variable name
```

#### Immediately retrieve a page-specific variable after setting it:
```py
actions.setPageVariable('number',1)
#replace number with your desired variable name
Expand Down Expand Up @@ -147,3 +165,9 @@ return sum(product["price"] for product in data["products"] if product["category
:::info
Issues with writing custom Python code? Ask in our [Slack community](https://www.tooljet.com/slack).
:::

## Refer Python Query Data in Components

Just like other dynamic values, you can refer the data returned by **Run Python code** queries using double curly braces`{{}}`.

For instance, if you have a **Run Python code** query named *updatedProductInfo*, you can pass `{{queries.updatedProductInfo.data}}` under the `Data` property of a Table component to populate it with the data returned by the *updatedProductInfo* query.
6 changes: 6 additions & 0 deletions docs/versioned_docs/version-2.25.0/data-sources/run-py.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,9 @@ return sum(product["price"] for product in data["products"] if product["category
:::info
Issues with writing custom Python code? Ask in our [Slack community](https://www.tooljet.com/slack).
:::

## Refer Python Query Data in Components

Just like other dynamic values, you can refer the data returned by **Run Python code** queries using double curly braces`{{}}`.

For instance, if you have a **Run Python code** query named *updatedProductInfo*, you can pass `{{queries.updatedProductInfo.data}}` under the `Data` property of a Table component to populate it with the data returned by the *updatedProductInfo* query.
6 changes: 6 additions & 0 deletions docs/versioned_docs/version-2.27.0/data-sources/run-py.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,9 @@ return sum(product["price"] for product in data["products"] if product["category
:::info
Issues with writing custom Python code? Ask in our [Slack community](https://www.tooljet.com/slack).
:::

## Refer Python Query Data in Components

Just like other dynamic values, you can refer the data returned by **Run Python code** queries using double curly braces`{{}}`.

For instance, if you have a **Run Python code** query named *updatedProductInfo*, you can pass `{{queries.updatedProductInfo.data}}` under the `Data` property of a Table component to populate it with the data returned by the *updatedProductInfo* query.
8 changes: 8 additions & 0 deletions docs/versioned_docs/version-2.29.0/data-sources/run-py.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ await queries.getCustomerData.run()

value = queries.getCustomerData.getRawData()
#replace getCustomerData with your query name

value
```

#### Retrieve the loading state of a query:
Expand Down Expand Up @@ -151,3 +153,9 @@ return sum(product["price"] for product in data["products"] if product["category
:::info
Issues with writing custom Python code? Ask in our [Slack community](https://www.tooljet.com/slack).
:::

## Refer Python Query Data in Components

Just like other dynamic values, you can refer the data returned by **Run Python code** queries using double curly braces`{{}}`.

For instance, if you have a **Run Python code** query named *updatedProductInfo*, you can pass `{{queries.updatedProductInfo.data}}` under the `Data` property of a Table component to populate it with the data returned by the *updatedProductInfo* query.
30 changes: 27 additions & 3 deletions docs/versioned_docs/version-2.30.0/data-sources/run-py.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ await queries.getSalesData.run()

value = queries.getSalesData.getData()
#replace getSalesData with your query name

value
```

#### Trigger a query and retrieve its raw data:
Expand All @@ -69,6 +71,8 @@ await queries.getCustomerData.run()

value = queries.getCustomerData.getRawData()
#replace getCustomerData with your query name

value
```

#### Trigger a query and retrieve its loading state:
Expand All @@ -78,13 +82,21 @@ await queries.getTodos.run()

value = queries.getTodos.getLoadingState()
#replace getTodos with your query name

value
```

## Get Variables

To immediately access a variable or page variable after setting it in the **Run Python code**, you can use the below functions:
To set and access variables or page variables in **Run Python code**, you can use the below functions:

#### Set a variable:
```py
actions.setVariable('color','blue')
#replace color with your desired variable name
```

#### Set and retrieve a variable:
#### Immediately retrieve a variable after setting it:
```py
actions.setVariable('mode','dark')
#replace mode with your desired variable name
Expand All @@ -93,7 +105,13 @@ actions.getVariable('mode')
#replace mode with your desired variable name
```

#### Set and retrieve a page-specific variable:
#### Set a page-specific variable:
```py
actions.setPageVariable('version',1)
#replace version with your desired variable name
```

#### Immediately retrieve a page-specific variable after setting it:
```py
actions.setPageVariable('number',1)
#replace number with your desired variable name
Expand Down Expand Up @@ -147,3 +165,9 @@ return sum(product["price"] for product in data["products"] if product["category
:::info
Issues with writing custom Python code? Ask in our [Slack community](https://www.tooljet.com/slack).
:::

## Refer Python Query Data in Components

Just like other dynamic values, you can refer the data returned by **Run Python code** queries using double curly braces`{{}}`.

For instance, if you have a **Run Python code** query named *updatedProductInfo*, you can pass `{{queries.updatedProductInfo.data}}` under the `Data` property of a Table component to populate it with the data returned by the *updatedProductInfo* query.
30 changes: 27 additions & 3 deletions docs/versioned_docs/version-2.33.0/data-sources/run-py.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ await queries.getSalesData.run()

value = queries.getSalesData.getData()
#replace getSalesData with your query name

value
```

#### Trigger a query and retrieve its raw data:
Expand All @@ -69,6 +71,8 @@ await queries.getCustomerData.run()

value = queries.getCustomerData.getRawData()
#replace getCustomerData with your query name

value
```

#### Trigger a query and retrieve its loading state:
Expand All @@ -78,13 +82,21 @@ await queries.getTodos.run()

value = queries.getTodos.getLoadingState()
#replace getTodos with your query name

value
```

## Get Variables

To immediately access a variable or page variable after setting it in the **Run Python code**, you can use the below functions:
To set and access variables or page variables in **Run Python code**, you can use the below functions:

#### Set a variable:
```py
actions.setVariable('color','blue')
#replace color with your desired variable name
```

#### Set and retrieve a variable:
#### Immediately retrieve a variable after setting it:
```py
actions.setVariable('mode','dark')
#replace mode with your desired variable name
Expand All @@ -93,7 +105,13 @@ actions.getVariable('mode')
#replace mode with your desired variable name
```

#### Set and retrieve a page-specific variable:
#### Set a page-specific variable:
```py
actions.setPageVariable('version',1)
#replace version with your desired variable name
```

#### Immediately retrieve a page-specific variable after setting it:
```py
actions.setPageVariable('number',1)
#replace number with your desired variable name
Expand Down Expand Up @@ -147,3 +165,9 @@ return sum(product["price"] for product in data["products"] if product["category
:::info
Issues with writing custom Python code? Ask in our [Slack community](https://www.tooljet.com/slack).
:::

## Refer Python Query Data in Components

Just like other dynamic values, you can refer the data returned by **Run Python code** queries using double curly braces`{{}}`.

For instance, if you have a **Run Python code** query named *updatedProductInfo*, you can pass `{{queries.updatedProductInfo.data}}` under the `Data` property of a Table component to populate it with the data returned by the *updatedProductInfo* query.
30 changes: 27 additions & 3 deletions docs/versioned_docs/version-2.34.0/data-sources/run-py.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ await queries.getSalesData.run()

value = queries.getSalesData.getData()
#replace getSalesData with your query name

value
```

#### Trigger a query and retrieve its raw data:
Expand All @@ -69,6 +71,8 @@ await queries.getCustomerData.run()

value = queries.getCustomerData.getRawData()
#replace getCustomerData with your query name

value
```

#### Trigger a query and retrieve its loading state:
Expand All @@ -78,13 +82,21 @@ await queries.getTodos.run()

value = queries.getTodos.getLoadingState()
#replace getTodos with your query name

value
```

## Get Variables

To immediately access a variable or page variable after setting it in the **Run Python code**, you can use the below functions:
To set and access variables or page variables in **Run Python code**, you can use the below functions:

#### Set a variable:
```py
actions.setVariable('color','blue')
#replace color with your desired variable name
```

#### Set and retrieve a variable:
#### Immediately retrieve a variable after setting it:
```py
actions.setVariable('mode','dark')
#replace mode with your desired variable name
Expand All @@ -93,7 +105,13 @@ actions.getVariable('mode')
#replace mode with your desired variable name
```

#### Set and retrieve a page-specific variable:
#### Set a page-specific variable:
```py
actions.setPageVariable('version',1)
#replace version with your desired variable name
```

#### Immediately retrieve a page-specific variable after setting it:
```py
actions.setPageVariable('number',1)
#replace number with your desired variable name
Expand Down Expand Up @@ -147,3 +165,9 @@ return sum(product["price"] for product in data["products"] if product["category
:::info
Issues with writing custom Python code? Ask in our [Slack community](https://www.tooljet.com/slack).
:::

## Refer Python Query Data in Components

Just like other dynamic values, you can refer the data returned by **Run Python code** queries using double curly braces`{{}}`.

For instance, if you have a **Run Python code** query named *updatedProductInfo*, you can pass `{{queries.updatedProductInfo.data}}` under the `Data` property of a Table component to populate it with the data returned by the *updatedProductInfo* query.
30 changes: 27 additions & 3 deletions docs/versioned_docs/version-2.35.0/data-sources/run-py.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ await queries.getSalesData.run()

value = queries.getSalesData.getData()
#replace getSalesData with your query name

value
```

#### Trigger a query and retrieve its raw data:
Expand All @@ -69,6 +71,8 @@ await queries.getCustomerData.run()

value = queries.getCustomerData.getRawData()
#replace getCustomerData with your query name

value
```

#### Trigger a query and retrieve its loading state:
Expand All @@ -78,13 +82,21 @@ await queries.getTodos.run()

value = queries.getTodos.getLoadingState()
#replace getTodos with your query name

value
```

## Get Variables

To immediately access a variable or page variable after setting it in the **Run Python code**, you can use the below functions:
To set and access variables or page variables in **Run Python code**, you can use the below functions:

#### Set a variable:
```py
actions.setVariable('color','blue')
#replace color with your desired variable name
```

#### Set and retrieve a variable:
#### Immediately retrieve a variable after setting it:
```py
actions.setVariable('mode','dark')
#replace mode with your desired variable name
Expand All @@ -93,7 +105,13 @@ actions.getVariable('mode')
#replace mode with your desired variable name
```

#### Set and retrieve a page-specific variable:
#### Set a page-specific variable:
```py
actions.setPageVariable('version',1)
#replace version with your desired variable name
```

#### Immediately retrieve a page-specific variable after setting it:
```py
actions.setPageVariable('number',1)
#replace number with your desired variable name
Expand Down Expand Up @@ -147,3 +165,9 @@ return sum(product["price"] for product in data["products"] if product["category
:::info
Issues with writing custom Python code? Ask in our [Slack community](https://www.tooljet.com/slack).
:::

## Refer Python Query Data in Components

Just like other dynamic values, you can refer the data returned by **Run Python code** queries using double curly braces`{{}}`.

For instance, if you have a **Run Python code** query named *updatedProductInfo*, you can pass `{{queries.updatedProductInfo.data}}` under the `Data` property of a Table component to populate it with the data returned by the *updatedProductInfo* query.

0 comments on commit 712800e

Please sign in to comment.