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
Copy file name to clipboardExpand all lines: content/en/docs/howto/extensibility/howto-datastorage-api.md
+26-27Lines changed: 26 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -166,7 +166,7 @@ The result is a generic OQL action that you can use in your microflows as follow
166
166
167
167
## Retrieving Objects Using OQL Specified in a Dataset
168
168
169
-
Instead of coding the OQL statement in a string parameter, you can also use a Dataset. This has the benefit the that Mendix Studio Pro will validate your OQL query.
169
+
Instead of coding the OQL statement in a string parameter, you can also use a Dataset. This has the benefit that Mendix Studio Pro will validate your OQL query.
@@ -209,36 +209,35 @@ Below is the Java code to get the Dataset OQL, execute the OQL, and retrieve the
209
209
return resultList;
210
210
// END USER CODE
211
211
}
212
-
213
212
```
214
213
215
214
## Retrieving Objects Using SQL
216
215
217
-
An API is available to allow you to execute SQL queries on the application database (this feature is currently in beta). Using this API, you can create a microflow action to execute SQL: similar to the action for OQL in the previous sections.
216
+
You can use an API call to execute SQL queries on the application database (this feature is currently in beta). Using this call, you can create a microflow action to execute SQL: similar to the action for OQL in the previous sections.
218
217
219
218
The definition of the Java action resembles the OQL action, but instead of an OQL parameter you have an SQL parameter.
The Java implementation below implements the following steps:
222
+
The Java code below implements the following steps:
224
223
225
-
* Use *Core.dataStorage().executeWithConnection()* to execute some Java statements that receive a JDBC connection from the internal connection pool. This API is constructed to enable the Mendix Platform to guarantee that connections are returned to the pool after usage.
224
+
* Use *Core.dataStorage().executeWithConnection()* to execute some Java statements that receive a JDBC connection from the internal connection pool. Using this call enables the Mendix Platform to guarantee that connections are returned to the pool after use.
@@ -250,7 +249,7 @@ The Java implementation below implements the following steps:
250
249
ResultSetMetaData rmd = rset.getMetaData();
251
250
int colCount = rmd.getColumnCount(); ```
252
251
253
-
*Next you loop through all the records in the `ResultSet` and create a Mendix object as specified by the user via ResultEntity.
252
+
*Next you loop through all the records in the `ResultSet` and, for each record, create a Mendix object as specified by the user via ResultEntity.
254
253
255
254
```java
256
255
while(rset.next()){
@@ -265,12 +264,12 @@ The Java implementation below implements the following steps:
265
264
266
265
You can find the complete Java source code in the *QueryApiBlogPost*GitHub repo on GitHub: [RetrieveAdvancedSQL](https://github.com/ako/QueryApiBlogPost/blob/master/javasource/hr/actions/RetrieveAdvancedSql.java).
267
266
268
-
You now have a generic SQL action that can be used in microflows to retrieve data from your application database. The query in this example returns the same data as the OQL earlier, so you can reuse the non-persistable entity DepartmentSummary as defined previously.
267
+
You now have a generic SQL action that can be used in microflows to retrieve data from your application database. The query in this example returns the same data as the OQL earlier, so you can reuse the non-persistable entity **DepartmentSummary** as defined previously.
Note that in case ofSQL statements you need to implement security constraints yourself.
271
+
{{% alert color="warning"%}}
272
+
If you useSQL statements you need to implement security constraints yourself.
274
273
{{%/alert %}}
275
274
276
275
## PostgreSQL-specific SQL
@@ -281,11 +280,11 @@ Using the JDBC connection you can benefit from vendor specific database extensio
281
280
If you use vendor specific database functionality you will not be able to deploy your application seamlessly on other platforms and databases. Therefore, we advise you to use SQL only if you have no alternative way of implementing your requirements. In most cases you should be able to use OQL to achieve the same result, whilst keeping your application database independent.
282
281
{{%/alert %}}
283
282
284
-
The following example illustrates the use of PostgreSQL-specific functionality. It serves as an example of how you can dothis, but in this specific case an alternative solution, either using microflows or Java actions, is better as it would keep your application database independent.
283
+
The following example illustrates the use of PostgreSQL-specific functionality. It serves as an example of how you can dothis, but in this specific case an alternative solution, either using microflows or Java actions, would be better as it would keep your application database independent.
285
284
286
-
The requirement forthis example is to generate a list of dates for all first Mondays of the month between a range specified by the user.
285
+
The requirement forthis example is to generate a list of dates for all the first Mondays of the month within a range specified by the user.
287
286
288
-
This example has a page where a user can enter a start and end date. The microflow triggered by the **Generate first Mondays of the month** button will print all the respective dates.
287
+
This example has a page where an end-user can enter a start and end date. The microflow triggered by the **Generate first Mondays of the month** button will write all the respective dates to the log.
@@ -399,7 +398,7 @@ All the code is also available in [CreateDateRangeList.java](https://github.com/
399
398
// END USER CODE
400
399
```
401
400
402
-
When you use this in a microflow, you just need to specify the start and end dates, and the name of the resulting list. This example iterates through all the data objects in the list and prints the date of that object.
401
+
When you use this in a microflow, you just need to specify the start and end dates, and the name of the resulting list. This example iterates through all the data objects in the list and writes the date of that object to the log.
Copy file name to clipboardExpand all lines: content/en/docs/refguide/modeling/resources/data-sets/_index.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,8 @@ weight: 50
9
9
10
10
A dataset is defined using either an [OQL query](/refguide/oql/) or a custom [Java action](/refguide/java-actions/). To constrain a dataset, parameters can be defined which can be used in the OQL query or Java action.
11
11
12
+
For one use of a dataset, see [Retrieving Objects Using OQL Specified in a Dataset](/howto/extensibility/howto-datastorage-api/#retrieving-objects-using-oql-specified-in-a-dataset) in *How to Use Mendix Data Storage APIs to Build Reusable Microflow Actions*.
13
+
12
14
## General
13
15
14
16
Fields for datasets contain the following properties:
0 commit comments