- Community Commons:模块向您的应用程序添加了许多可重用的 Java 方法,这些方法可以从微流或自定义 Java 操作中调用。该模块还添加了处理日期、批次、字符串、互联网、文件和配置的功能。
- OQL:该模块允许您从微流执行OQL查询。用于测试和导出OQL查询的代码片段,用动作添加参数,执行查询返回实体,执行查询并返回CSV等。
- HTML/ JavaScript Snippet:使用这个小部件可以在表单中添加一段HTML或JavaScript(例如嵌入YouTube视频或flash对象),或者通过添加任意HTML元素来增强样式。
- Mx Model Reflection:Mx 模型反射模块允许您从应用程序访问有关域模型和应用程序微流的信息。例如,您可以循环遍历微流中实体类型的所有属性名称。
- Excel Exporter:[示例] 使用Excel 导出器模块,您可以创建将数据从Mendix应用程序导出到 Excel、启用宏的 Excel 或 CSV 格式的模板。该模块创建 OQL 查询并以您所需的格式直接将结果打印到 FileDocument系统模块实体。您可以向 Excel 添加样式以创建适当的标题和样式格式,从而创建完整的报告。
OQL官方教程: 在线手册
Query data from the Mendix database and the result will be mapped to a Mendix entity. The example below is part of the Example module within the project, located on the GitHub repository.
Considering the following domain model:
One can execute a query obtaining all objects of ExamplePerson as a table. The rows within this table can be converted to non persistent entities for further usage. Therefore a ExamplePersonResult non persistent entity is modeled.
Parameters can be used using their corresponding actions (for each data type there's one activity defined:
All parameters should be added before executing an OQL query.
Adding an parameter requires:
The name of the parameter, without a $ (e.g. Gender). The value. Executing an OQL query requires:
The OQL statement. A resulting entity (e.g. OQLExample.ExamplePersonResult). Amount. Offset.
After executing an OQL query, all previously set parameters are cleared.
The example query used to obtain the ExamplePersonResults are is:
SELECT P.id ExamplePersonResult_ExamplePerson, P.Name Name, P.Number Number, P.DateOfBirth DateOfBirth, P.Age Age, P.LongAge LongAge, P.HeightInFloat HeightInFloat, P.HeightInDecimal HeightInDecimal, P.Active Active, P.Gender Gender FROM OQLExample.ExamplePerson P WHERE P.Active = $Active AND P.Age = $Age AND P.DateOfBirth = $DateOfBirth AND P.Gender = $Gender AND P.HeightInDecimal = $HeightInDecimal AND P.HeightInFloat = $HeightInFloat AND P.LongAge = $LongAge AND P.Name = $Name AND P.Number = $Number AND P/OQL.MarriedTo/OQL.ExamplePerson/ID = $MarriedTo
In the example above, the resulting columns Name, Number, DateOfBirth, Age, etc. are mapped to their corresponding attributes in ExamplePersonResult. The column ExamplePersonResult_ExamplePerson is mapped to the association (so one can retrieve the original persistent entity if needed).