This repository was archived by the owner on Jan 7, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataobject-instance-query.html
More file actions
141 lines (124 loc) · 6.75 KB
/
dataobject-instance-query.html
File metadata and controls
141 lines (124 loc) · 6.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<script type="text/javascript">
RED.nodes.registerType('dataobject-instance-query', {
category: 'ProcessCube',
color: '#02AFD6',
defaults: {
name: { value: '' },
engine: { value: '', type: 'processcube-engine-config' },
query: { value: 'payload' },
query_type: { value: 'msg' },
onlyNewest: { value: true },
},
inputs: 1,
outputs: 1,
icon: 'data-object-query.svg',
label: function () {
return this.name || 'dataobject-instance-query';
},
oneditprepare: function () {
$('#node-input-query').typedInput({
default: 'msg',
types: ['msg', 'json'],
});
$('#node-input-query').typedInput('value', this.query);
$('#node-input-query').typedInput('type', this.query_type);
},
oneditsave: function () {
(this.query = $('#node-input-query').typedInput('value')),
(this.query_type = $('#node-input-query').typedInput('type'));
},
});
</script>
<script type="text/html" data-template-name="dataobject-instance-query">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name" />
</div>
<div class="form-row">
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
<input type="text" id="node-input-engine" placeholder="http://engine:8000" />
</div>
<div class="form-row">
<label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
<input type="text" id="node-input-query" />
</div>
<div class="form-row">
<label for="node-input-onlyNewest"><i class="fa fa-hand"></i>Only current instance per dataObject</label>
<input type="checkbox" id="node-input-onlyNewest" title="Applys a client-side filter, that returns just the newest instance per dataObject">
</div>
</script>
<script type="text/markdown" data-help-name="dataobject-instance-query">
A node to query dataobject instances on the ProcessCube Engine.
## Inputs
: msg (Object | JSON) : The selected field of the *msg*, eg *payload*, will be used as the input for the query or can be directly set as JSON.
: query (Object) : The query that was used.
## Outputs
: dataObjectInstances (Array) : The dataobject instances that matched the query.
: totalCount (number) : The number of matches.
### Query fields
**Summary**:
**Description**: Gets all DataObjectInstances that match the given query.
#### Parameters:
- Name: `offset` Required: `false`
- Type: number
- Description: The index of the first DataObjectInstance to include in the result set.
- Name: `limit` Required: `false`
- Type: number
- Description: The maximum number of DataObjectInstances to return.
- Name: `dataObjectId` Required: ``
- Type: Array<string> | string | SearchQuery
- string: myDataObjectId_12345678
- Array<string>: myDataObjectId_12345678,myDataObjectId_87654321
- object:
- Description: Filter by the ID of the DataObject.
- Name: `flowNodeInstanceId` Required: ``
- Type: Array<string> | string | SearchQuery
- string: myFlowNodeInstanceId_12345678
- Array<string>: myFlowNodeInstanceId_12345678,myFlowNodeInstanceId_87654321
- object:
- Description: Filter by the ID of the FlowNodeInstance that wrote to the DataObject.
- Name: `processInstanceId` Required: ``
- Type: Array<string> | string | SearchQuery
- string: myProcessInstance_12345678
- Array<string>: myProcessInstance_12345678,myProcessInstance_87654321
- object:
- Description: Filter by the ID of the ProcessInstances.
- Name: `processDefinitionId` Required: ``
- Type: Array<string> | string | SearchQuery
- string: myProcess_12345678
- Array<string>: myProcess_12345678,myProcess_87654321
- object:
- Description: Filter by the ID of the ProcessDefinition that the DataObjectInstances belong to.
- Name: `processModelId` Required: ``
- Type: Array<string> | string | SearchQuery
- string: myProcessModel_12345678
- Array<string>: myProcessModel_12345678,myProcessModel_87654321
- object:
- Description: Filter by the ID of the ProcessModel that the DataObjectInstances belong to.
- Name: `embeddedProcessModelId` Required: ``
- Type: Array<string> | string | SearchQuery
- string: myProcessModel_12345678
- Array<string>: myProcessModel_12345678,myProcessModel_87654321
- object:
- Description: Filter by the ID of the EmbeededProcessModel that the DataObjectInstances belong to.
- Name: `createdAt` Required: ``
- Type: Array<string> | string
- string: 2021-01-01T00:00:00.000Z
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
- Description: The created date of the DataObjectInstances to include in the results.
### Only current instance per dataObject
When checked, an additional filter is applied to the result of the query.
For each `dataObjectId`+`processInstanceId` in the result set, only the instance with the newest `createdAt` timestamp will be returned.
Therefore, it creates a list containing only the current values of each dataObject.
**Note**: This is not guranteed to work as described above. Since this is a client-side filter, that is applied after executing the server side query, there are some limitations.
Depending on your query, you might not load all instances of an dataObject. I.e. when setting a limit or offset. Or when querying such an amount of instances, that the engine applies an automatic limit.
In these cases, this filter will still be applied and return the newest instance from the result set, but that might not be the actual newest value for this dataObject, which would be available in the engines database.
To avoid thoses problems, make sure to write strict queries, which are guranteed to have a small result set, that can be retrieved in one request.
The `totalCount` property will, as well, not work as expected. Since this is a value created by the engine, it will not line up with the actual amount of instances, that are returned.
**Note**: This feature will be removed in a future version.
Due to the problems described above, this functionality should rather be provided by the engines interface.
As soon as the engine supports querying for the newest dataObject values, this filter becomes obsolete and you should instead alter your query to apply this filter server-side.
### References
- [The ProcessCube© Developer Network](https://processcube.io) - All documentation for the ProcessCube© platform
- [ProcessCube© LowCode Integration](https://processcube.io/docs/node-red) - LowCode integration in ProcessCube©
</script>