Skip to content

Commit 5d990aa

Browse files
adnanqaopsgitbook-bot
authored andcommitted
GITBOOK-193: Going Back to an Historic Version, Updates related to Queries
1 parent 081cd69 commit 5d990aa

File tree

13 files changed

+62
-14
lines changed

13 files changed

+62
-14
lines changed
Loading
Loading
Loading
Loading
-336 KB
Loading
137 KB
Loading

docs/business-logic-in-apps/write-javascript/built-in-js-functions.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ utils.downloadFile(data: any, fileName: string, options?: {
5959
} )
6060
```
6161

62-
| Parameter | Description |
63-
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
64-
| data | Required. A **String** or **Object** that specifies the data to download from queries, components, transformers, etc. |
65-
| fileName | Required. A **String** value that specifies the name of the file to download. |
66-
| fileType | Optional. A **String** value that specifies the type of the file to download. All [MIME types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics\_of\_HTTP/MIME\_types/Common\_types) are supported. |
67-
| dataType | Optional. A **String** value that specifies the type of the data: "url" or "base64". |
62+
| Parameter | Description |
63+
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
64+
| data | Required. A **String** or **Object** that specifies the data to download from queries, components, transformers, etc. |
65+
| fileName | Required. A **String** value that specifies the name of the file to download. |
66+
| fileType | Optional. A **String** value that specifies the type of the file to download. All [MIME types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) are supported. |
67+
| dataType | Optional. A **String** value that specifies the type of the data: "url" or "base64". |
6868

6969
```javascript
7070
// Example: Download the base64 data from a file component as a PNG file named users-data.
@@ -104,6 +104,15 @@ utils.copyToClipboard( text: string )
104104
utils.copyToClipboard( input1.value )
105105
```
106106

107+
### utils.logoutUser()
108+
109+
Logout a User from the current Session.
110+
111+
```javascript
112+
// Syntax
113+
utils.logOut()
114+
```
115+
107116
## message - global notification
108117

109118
Use `message` methods to send a global alert notification, which displays at the top of the screen and lasts for 3 seconds by default. Each of the following four methods supports a unique display style.

docs/business-logic-in-apps/write-javascript/javascript-query.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Use `return` syntax to return result. For example, the following code returns `3
5353
return Math.floor(3.4)
5454
```
5555

56-
The result returned can also be a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Promise) object. For example, `query2.run()` returns a Promise object.
56+
The result returned can also be a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object. For example, `query2.run()` returns a Promise object.
5757

5858
```javascript
5959
return query2.run()
@@ -81,7 +81,7 @@ input1.setValue("Hello");
8181
```
8282
8383
{% hint style="warning" %}
84-
The `input1.setValue()` method (or other component methods) is asynchronous and returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Promise) object. Accessing `input1.value` immediately after setting the value of `input1` does not return the updated value.
84+
The `input1.setValue()` method (or other component methods) is asynchronous and returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object. Accessing `input1.value` immediately after setting the value of `input1` does not return the updated value.
8585
{% endhint %}
8686
8787
## Run query
@@ -173,6 +173,18 @@ Then trigger this query in **Run JavaScript** of event handlers in each of the i
173173
174174
You can find another demo for using passed-in paramter queries [here](https://cloud.lowcoder.dev/apps/637f38daa899fe1ffcb17f0b/view).
175175
176+
## Trigger a query
177+
178+
Sometimes, we need to trigger a query in relation to an event, e.g. After Page/App loads or After some query has been executed or after some Timeout interval. In Lowcoder app, we provide these options to fulfil such requirements : 
179+
180+
<figure><img src="../../.gitbook/assets/frame_generic_light.png" alt=""><figcaption><p>Options to Trigger a query</p></figcaption></figure>
181+
182+
1. **When Inputs Change**
183+
2. **After Query Execution**
184+
3. **After Application ( Page ) loads and Timeout**
185+
4. **When the Application ( Page ) loads**
186+
5. **Only when you trigger it manually**
187+
176188
## Declare a function
177189
178190
You can declare functions inside a JS query for better readability.

docs/connect-your-data/data-sources-in-lowcoder/sql-databases/supabase/supabase-realtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ More details related to Supabase RealTime can be be found here on their official
2626

2727
First, make sure Realtime is enabled in your Supabase project. This is usually done in the Supabase dashboard by toggling on the Realtime feature for specific tables or schemas.
2828

29-
<figure><img src="../../../../.gitbook/assets/frame_generic_light.png" alt=""><figcaption><p>Enabling RealTime on a Supabase Table</p></figcaption></figure>
29+
<figure><img src="../../../../.gitbook/assets/frame_generic_light (3).png" alt=""><figcaption><p>Enabling RealTime on a Supabase Table</p></figcaption></figure>
3030

3131
#### 2. Client Side Subscription / Initiating Connection
3232

docs/connect-your-data/query-basics/README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,35 @@ Lowcoder evaluates your query statement with JavaScript code inside `{{ }}` in r
3232

3333
Lowcoder triggers your queries in two modes: it runs automatically when "inputs change or on page load" or manually (and so invoked in other event handlers for example).&#x20;
3434

35-
### Inputs change or on page load
35+
Sometimes, we need to trigger a query in relation to an event, e.g. After Page/App loads or After some query has been executed or after some Timeout interval. In Lowcoder app, we provide these options to fulfil such requirements. You can Trigger the query using the "Triggered when" dropdown field inside a Query, as follow :&#x20;
3636

37-
Queries set to this mode automatically run when dependent inputs change or on page load. For example, the query result of `select * from users where customer_id = {{input.value}}` updates immediately when `input.value` changes. \*\*\*\* This mode to run a query is recommended for queries reading data from data sources.
37+
<figure><img src="../../.gitbook/assets/frame_generic_light.png" alt=""><figcaption><p>Options to Trigger a query</p></figcaption></figure>
38+
39+
### Automatic Mode : Inputs change or on page load
40+
41+
In Automatic Mode, we have following Query Trigger options :&#x20;
42+
43+
* **When Inputs Change**
44+
* **When the Application ( Page ) loads**
45+
* **After Application ( Page ) loads and Timeout**
46+
* **After Query Execution**
47+
48+
1. **When Inputs Change :** \
49+
Queries set to this mode automatically run when dependent inputs change. For example, the query result of `select * from users where customer_id = {{input.value}}` updates immediately when `input.value` changes. \*\*\*\* This mode to run a query is recommended for queries reading data from data sources.
3850

3951
{% hint style="warning" %}
4052
Consider carefully when to trigger a query. Data Queries that may take longer to respond may block the application visuals from loading properly and displaying your data.&#x20;
4153
{% endhint %}
4254

55+
2. **When the Application ( Page ) loads :** \
56+
Queries set to this mode automatically run when the Application starts loading. For example, showing latest news feed on an App, we would like to trigger the query to fetch the latest news as soon as App starts loading.\
57+
58+
3. **After Application ( Page ) loads and Timeout :** \
59+
Queries set to this mode automatically run when we require to trigger a query after an App has loaded or Timeout happened. For example, you have some list of Users that you don't want to load with the App , but after some Time delay e.g. 10 sec .\
60+
61+
4. **After Query Execution :**\
62+
Queries set to this mode automatically run after a dependent query has been executed. For example, a query B is dependant on a query A's data, so we need to execute query B after query A has been successfully executed. Think of a scenario where Query A validates the access token of a User, and based on the Query A output, Query B executes and show User some specific data.
63+
4364
### Manually invoked
4465

4566
For this mode of queries, they run only with your manual trigger, such as a button or link click. You need to specify an event handler to trigger the query. This mode is recommended for queries writing data to data sources, because you may need to confirm that the input is complete and error-free before running it.

docs/connect-your-data/query-basics/bind-query-data-to-components.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ You can access the values in an array by index. The index always starts at 0, so
2525

2626
The **Data** property of **Table** component is an array of objects. This GIF shows how to access the value of `first_name` in the first element of the **data** array in `table1`.
2727

28+
## Query Usage Display
29+
30+
While developing, we often lose track the components where we have used the queries, and have to look for the components when we need to perform CRUD operations on queries. It is a time taking process and we can lose track of where our queries are utilised. To tackle this, we have introduced Query Usage Display, showing you exactly where each query is used across your app. You will find it at each Data Query in the "Advanced" tab :&#x20;
31+
32+
<figure><img src="../../.gitbook/assets/frame_generic_light (1).png" alt=""><figcaption><p>Query Usage Display</p></figcaption></figure>
33+
2834
## Transform data
2935

3036
You can leverage built-in JS functions and third-party libraries in `{{ }}` to transform data, such as `filter()`, `map()` and `reduce()` operations.

docs/workspaces-and-teamwork/workspaces/enterprise-mode.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ In Enterprise Mode, there is only One Workspace that gets created automatically
77
1. In Local Setup, we have a Root Admin User, that we can configure in docker-compose-multi.yml file. This user will be created by default and it will Super Admin of the default Workspace.\
88

99

10-
<figure><img src="../../.gitbook/assets/frame_generic_light (3) (1).png" alt=""><figcaption></figcaption></figure>
10+
<figure><img src="../../.gitbook/assets/frame_generic_light (3) (1) (1).png" alt=""><figcaption></figcaption></figure>
1111
2. Set LOWCODER\_WORKSPACE\_MODE to "ENTERPRISE" in docker-compose-multi.yml file. \
1212

1313

14-
<figure><img src="../../.gitbook/assets/frame_generic_light (3).png" alt=""><figcaption></figcaption></figure>
14+
<figure><img src="../../.gitbook/assets/frame_generic_light (3) (1).png" alt=""><figcaption></figcaption></figure>
1515
3. In the above screenshot, you can see three configuration variables regarding Email and Workspace creation on Sign up. Let's go through these one by one.&#x20;
1616
1. **LOWCODER\_EMAIL\_SIGNUP\_ENABLED**\
1717
\

docs/workspaces-and-teamwork/workspaces/saas-mode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ In SAAS Mode, User can create multiple Workspaces. With some other settings, Adm
2323
LOWCODE\_EMAIL\_SIGNUP\_ENABLED = **true**\
2424

2525

26-
<figure><img src="../../.gitbook/assets/frame_generic_light (1) (1).png" alt=""><figcaption></figcaption></figure>
26+
<figure><img src="../../.gitbook/assets/frame_generic_light (1) (1) (1).png" alt=""><figcaption></figcaption></figure>
2727

2828
LOWCODE\_EMAIL\_SIGNUP\_ENABLED = **false**\
2929

0 commit comments

Comments
 (0)