You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 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". |
| 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". |
68
68
69
69
```javascript
70
70
// Example: Download the base64 data from a file component as a PNG file named users-data.
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.
Copy file name to clipboardExpand all lines: docs/business-logic-in-apps/write-javascript/javascript-query.md
+14-2Lines changed: 14 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ Use `return` syntax to return result. For example, the following code returns `3
53
53
return Math.floor(3.4)
54
54
```
55
55
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.
57
57
58
58
```javascript
59
59
return query2.run()
@@ -81,7 +81,7 @@ input1.setValue("Hello");
81
81
```
82
82
83
83
{% 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.
85
85
{% endhint %}
86
86
87
87
## Run query
@@ -173,6 +173,18 @@ Then trigger this query in **Run JavaScript** of event handlers in each of the i
173
173
174
174
You can find another demo for using passed-in paramter queries [here](https://cloud.lowcoder.dev/apps/637f38daa899fe1ffcb17f0b/view).
175
175
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
+
176
188
## Declare a function
177
189
178
190
You can declare functions inside a JS query for better readability.
Copy file name to clipboardExpand all lines: docs/connect-your-data/data-sources-in-lowcoder/sql-databases/supabase/supabase-realtime.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ More details related to Supabase RealTime can be be found here on their official
26
26
27
27
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.
28
28
29
-
<figure><imgsrc="../../../../.gitbook/assets/frame_generic_light.png"alt=""><figcaption><p>Enabling RealTime on a Supabase Table</p></figcaption></figure>
29
+
<figure><imgsrc="../../../../.gitbook/assets/frame_generic_light (3).png"alt=""><figcaption><p>Enabling RealTime on a Supabase Table</p></figcaption></figure>
30
30
31
31
#### 2. Client Side Subscription / Initiating Connection
Copy file name to clipboardExpand all lines: docs/connect-your-data/query-basics/README.md
+23-2Lines changed: 23 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -32,14 +32,35 @@ Lowcoder evaluates your query statement with JavaScript code inside `{{ }}` in r
32
32
33
33
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). 
34
34
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 : 
36
36
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><imgsrc="../../.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 : 
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.
38
50
39
51
{% hint style="warning" %}
40
52
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. 
41
53
{% endhint %}
42
54
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
+
43
64
### Manually invoked
44
65
45
66
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.
0 commit comments