qe-api-client 2.0.0__py3-none-any.whl → 2.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qe_api_client/api_classes/engine_app_api.py +27 -56
- qe_api_client/api_classes/engine_field_api.py +32 -22
- qe_api_client/api_classes/engine_generic_object_api.py +25 -8
- qe_api_client/api_classes/engine_global_api.py +2 -1
- qe_api_client/engine.py +134 -102
- qe_api_client/engine_helper.py +10 -10
- qe_api_client/structs.py +61 -73
- {qe_api_client-2.0.0.dist-info → qe_api_client-2.2.0.dist-info}/METADATA +1 -1
- qe_api_client-2.2.0.dist-info/RECORD +18 -0
- {qe_api_client-2.0.0.dist-info → qe_api_client-2.2.0.dist-info}/WHEEL +1 -1
- qe_api_client-2.0.0.dist-info/RECORD +0 -18
- {qe_api_client-2.0.0.dist-info → qe_api_client-2.2.0.dist-info}/LICENSE +0 -0
- {qe_api_client-2.0.0.dist-info → qe_api_client-2.2.0.dist-info}/top_level.txt +0 -0
@@ -141,10 +141,10 @@ class EngineAppApi:
|
|
141
141
|
Parameters:
|
142
142
|
doc_handle (int): The handle identifying the app document.
|
143
143
|
field_name (str): The name of the field to retrieve.
|
144
|
-
state_name (str): The name of the state. Default is
|
144
|
+
state_name (str): The name of the alternate state. Default state is current selections.
|
145
145
|
|
146
146
|
Returns:
|
147
|
-
dict:
|
147
|
+
dict: Object interface.
|
148
148
|
"""
|
149
149
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "GetField",
|
150
150
|
"params": {"qFieldName": field_name, "qStateName": state_name}})
|
@@ -154,22 +154,19 @@ class EngineAppApi:
|
|
154
154
|
except KeyError:
|
155
155
|
return response['error']
|
156
156
|
|
157
|
-
def create_object(self, doc_handle,
|
157
|
+
def create_object(self, doc_handle, prop):
|
158
158
|
"""
|
159
159
|
Creates a new object in the app identified by the document handle.
|
160
160
|
|
161
161
|
Parameters:
|
162
162
|
doc_handle (int): The handle identifying the app document.
|
163
|
-
|
164
|
-
q_type (str): The type of the new object. Default is "ListObject".
|
165
|
-
struct_name (str): The name of the structure defining the object. Default is "qListObjectDef".
|
166
|
-
ob_struct (dict): The structure defining the object.
|
163
|
+
prop (dict): Information about the object.
|
167
164
|
|
168
165
|
Returns:
|
169
166
|
dict: The created object (qReturn). In case of an error, returns the error information.
|
170
167
|
"""
|
171
168
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "method": "CreateObject", "handle": doc_handle,
|
172
|
-
"params":
|
169
|
+
"params": {"qProp": prop}})
|
173
170
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
174
171
|
try:
|
175
172
|
return response['result']['qReturn']
|
@@ -223,8 +220,16 @@ class EngineAppApi:
|
|
223
220
|
return response['error']
|
224
221
|
|
225
222
|
def clear_all(self, doc_handle, locked_also=False, alt_state=""):
|
223
|
+
"""
|
224
|
+
Clear selections in fields for current state. Locked fields are not cleared by default.
|
225
|
+
|
226
|
+
Parameters:
|
227
|
+
doc_handle (int): The handle identifying the app document.
|
228
|
+
locked_also (bool): When true, clears the selection for locked fields.
|
229
|
+
alt_state (str): Alternate state name. When set, applies to alternate state instead of current.
|
230
|
+
"""
|
226
231
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "ClearAll",
|
227
|
-
"params":
|
232
|
+
"params": {"qLockedAlso": locked_also, "qStateName": alt_state}})
|
228
233
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
229
234
|
try:
|
230
235
|
return response['result']
|
@@ -250,45 +255,24 @@ class EngineAppApi:
|
|
250
255
|
# can contain the same dimension.
|
251
256
|
# Parameters:
|
252
257
|
# qProp (MANDATORY: send dim_id, dim_title, dim_grouping, dim_field, dim_label, meta_def (optional) # NOQA
|
253
|
-
def
|
254
|
-
dim_grouping="N", dim_field='', dim_label='',
|
255
|
-
meta_def=""):
|
258
|
+
def create_dimension(self, doc_handle, prop):
|
256
259
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "CreateDimension",
|
257
|
-
"params":
|
258
|
-
"qInfo": {
|
259
|
-
"qId": dim_id,
|
260
|
-
"qType": "Dimension"
|
261
|
-
},
|
262
|
-
"qDim": {
|
263
|
-
"title": dim_title,
|
264
|
-
"qGrouping": dim_grouping,
|
265
|
-
"qFieldDefs": [
|
266
|
-
dim_field
|
267
|
-
],
|
268
|
-
"qFieldLabels": [
|
269
|
-
dim_label
|
270
|
-
]
|
271
|
-
},
|
272
|
-
"qMetaDef": {
|
273
|
-
"title": meta_def
|
274
|
-
}
|
275
|
-
}]
|
276
|
-
})
|
260
|
+
"params": {"qProp": prop}})
|
277
261
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
278
262
|
try:
|
279
|
-
return response[
|
263
|
+
return response["result"]["qReturn"]
|
280
264
|
except KeyError:
|
281
265
|
return response['error']
|
282
266
|
|
283
267
|
# DestroyDimension method: Removes a dimension
|
284
|
-
def
|
268
|
+
def destroy_dimension(self, doc_handle, dim_id):
|
285
269
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "DestroyDimension",
|
286
|
-
"params":
|
270
|
+
"params": {"qId": dim_id}})
|
287
271
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
288
272
|
try:
|
289
|
-
return response[
|
273
|
+
return response["result"]["qSuccess"]
|
290
274
|
except KeyError:
|
291
|
-
return response[
|
275
|
+
return response["error"]
|
292
276
|
|
293
277
|
# DestroyMeasure method: Removes a measure
|
294
278
|
def destroy_measure(self, doc_handle, measure_id):
|
@@ -347,25 +331,12 @@ class EngineAppApi:
|
|
347
331
|
# can contain the same dimension.
|
348
332
|
# Parameters:
|
349
333
|
# qProp (MANDATORY: send dim_id, dim_title, dim_grouping, dim_field, dim_label, meta_def (optional) # NOQA
|
350
|
-
def
|
351
|
-
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle,
|
352
|
-
"
|
353
|
-
"qInfo": {
|
354
|
-
"qId": measure_id,
|
355
|
-
"qType": "Measure"
|
356
|
-
},
|
357
|
-
"qMeasure": {
|
358
|
-
"qLabel": measure_title,
|
359
|
-
"qDef": measure_expr
|
360
|
-
},
|
361
|
-
"qMetaDef": {
|
362
|
-
"title": measure_title
|
363
|
-
}
|
364
|
-
}]
|
365
|
-
})
|
334
|
+
def create_measure(self, doc_handle, prop):
|
335
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "CreateMeasure",
|
336
|
+
"params": {"qProp": prop}})
|
366
337
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
367
338
|
try:
|
368
|
-
return response[
|
339
|
+
return response["result"]["qReturn"]
|
369
340
|
except KeyError:
|
370
341
|
return response['error']
|
371
342
|
|
@@ -702,9 +673,9 @@ class EngineAppApi:
|
|
702
673
|
except KeyError:
|
703
674
|
return response['error']
|
704
675
|
|
705
|
-
def create_session_object(self, doc_handle,
|
676
|
+
def create_session_object(self, doc_handle, prop):
|
706
677
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "CreateSessionObject",
|
707
|
-
"params":
|
678
|
+
"params": {"qProp": prop}})
|
708
679
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
709
680
|
try:
|
710
681
|
return response['result']['qReturn']
|
@@ -18,77 +18,87 @@ class EngineFieldApi:
|
|
18
18
|
"""
|
19
19
|
self.engine_socket = socket
|
20
20
|
|
21
|
-
def select(self, fld_handle, value):
|
21
|
+
def select(self, fld_handle, value, soft_lock = False, excluded_values_mode = 0):
|
22
22
|
"""
|
23
|
-
Selects
|
23
|
+
Selects field values matching a search string.
|
24
24
|
|
25
25
|
Args:
|
26
26
|
fld_handle (int): The handle of the field.
|
27
|
-
value (str):
|
27
|
+
value (str): String to search for. Can contain wild cards or numeric search criteria.
|
28
|
+
soft_lock (bool): Set to true to ignore locks; in that case, locked fields can be selected.
|
29
|
+
excluded_values_mode (int): Include excluded values in search.
|
28
30
|
|
29
31
|
Returns:
|
30
32
|
dict: The response from the engine, containing the result or an error message.
|
31
33
|
"""
|
32
34
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "Select",
|
33
|
-
"params":
|
35
|
+
"params": {"qMatch": value, "qSoftLock": soft_lock,
|
36
|
+
"qExcludedValuesMode": excluded_values_mode}})
|
34
37
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
35
38
|
try:
|
36
39
|
return response
|
37
40
|
except KeyError:
|
38
41
|
return response["error"]
|
39
42
|
|
40
|
-
def select_values(self, fld_handle, values=
|
43
|
+
def select_values(self, fld_handle, values, toggle_mode = False, soft_lock = False):
|
41
44
|
"""
|
42
45
|
Selects multiple values in a field.
|
43
46
|
|
44
47
|
Args:
|
45
48
|
fld_handle (int): The handle of the field.
|
46
|
-
values (list
|
49
|
+
values (list): A list of field values to select. Mandatory field.
|
50
|
+
toggle_mode (bool): The default value is false.
|
51
|
+
soft_lock (bool): Set to true to ignore locks; in that case, locked fields can be selected.
|
52
|
+
The default value is false.
|
47
53
|
|
48
54
|
Returns:
|
49
55
|
dict: The response from the engine, containing the result or an error message.
|
50
56
|
"""
|
51
|
-
if values is None:
|
52
|
-
values = []
|
53
57
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "SelectValues",
|
54
|
-
"params":
|
58
|
+
"params": {"qFieldValues": values, "qToggleMode": toggle_mode, "qSoftLock": soft_lock}})
|
55
59
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
56
60
|
try:
|
57
|
-
return response
|
61
|
+
return response["result"]["qReturn"]
|
58
62
|
except KeyError:
|
59
63
|
return response["error"]
|
60
64
|
|
61
|
-
def select_excluded(self, fld_handle):
|
65
|
+
def select_excluded(self, fld_handle, soft_lock=False):
|
62
66
|
"""
|
63
|
-
|
67
|
+
Inverts the current selections.
|
64
68
|
|
65
69
|
Args:
|
66
70
|
fld_handle (int): The handle of the field.
|
71
|
+
soft_lock (bool): Set to true to ignore locks; in that case, locked fields can be selected.
|
72
|
+
The default value is false.
|
67
73
|
|
68
74
|
Returns:
|
69
|
-
|
75
|
+
bool: true/false. The operation is successful if qReturn is set to true.
|
70
76
|
"""
|
71
|
-
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "SelectExcluded",
|
77
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "SelectExcluded",
|
78
|
+
"params": {"qSoftLock": soft_lock}})
|
72
79
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
73
80
|
try:
|
74
|
-
return response["result"]
|
81
|
+
return response["result"]["qReturn"]
|
75
82
|
except KeyError:
|
76
83
|
return response["error"]
|
77
84
|
|
78
|
-
def select_possible(self, fld_handle):
|
85
|
+
def select_possible(self, fld_handle, soft_lock=False):
|
79
86
|
"""
|
80
87
|
Selects all possible values in a field.
|
81
88
|
|
82
89
|
Args:
|
83
90
|
fld_handle (int): The handle of the field.
|
91
|
+
soft_lock (bool): Set to true to ignore locks; in that case, locked fields can be selected.
|
92
|
+
The default value is false.
|
84
93
|
|
85
94
|
Returns:
|
86
|
-
|
95
|
+
bool: true/false. The operation is successful if qReturn is set to true.
|
87
96
|
"""
|
88
|
-
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "SelectPossible",
|
97
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "SelectPossible",
|
98
|
+
"params": {"qSoftLock": soft_lock}})
|
89
99
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
90
100
|
try:
|
91
|
-
return response["result"]
|
101
|
+
return response["result"]["qReturn"]
|
92
102
|
except KeyError:
|
93
103
|
return response["error"]
|
94
104
|
|
@@ -102,7 +112,7 @@ class EngineFieldApi:
|
|
102
112
|
Returns:
|
103
113
|
dict: The response from the engine, containing the result or an error message.
|
104
114
|
"""
|
105
|
-
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "Clear", "params":
|
115
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "Clear", "params": {}})
|
106
116
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
107
117
|
try:
|
108
118
|
return response["result"]
|
@@ -119,9 +129,9 @@ class EngineFieldApi:
|
|
119
129
|
Returns:
|
120
130
|
int: The number of distinct values in the field, or an error message.
|
121
131
|
"""
|
122
|
-
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "GetCardinal", "params":
|
132
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "GetCardinal", "params": {}})
|
123
133
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
124
134
|
try:
|
125
|
-
return response["result"]
|
135
|
+
return response["result"]["qReturn"]
|
126
136
|
except KeyError:
|
127
137
|
return response["error"]
|
@@ -7,6 +7,7 @@ class EngineGenericObjectApi:
|
|
7
7
|
data visualization objects.
|
8
8
|
|
9
9
|
Methods:
|
10
|
+
create_child(handle, params): Creates a generic object that is a child of another generic object.
|
10
11
|
get_layout(handle): Retrieves the layout structure of a generic object.
|
11
12
|
get_full_property_tree(handle): Retrieves the full property tree of a generic object.
|
12
13
|
get_effective_properties(handle): Retrieves the effective properties of a generic object.
|
@@ -23,6 +24,23 @@ class EngineGenericObjectApi:
|
|
23
24
|
socket (object): The socket connection to the Qlik Sense engine.
|
24
25
|
"""
|
25
26
|
self.engine_socket = socket
|
27
|
+
def create_child(self, handle, params):
|
28
|
+
"""
|
29
|
+
Retrieves the layout structure of a specific generic object.
|
30
|
+
|
31
|
+
Parameters:
|
32
|
+
handle (int): The handle identifying the generic object.
|
33
|
+
params (str): The parameters of the generic object.
|
34
|
+
|
35
|
+
Returns:
|
36
|
+
dict: The layout structure of the generic object (qLayout). In case of an error, returns the error information.
|
37
|
+
"""
|
38
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": handle, "method": "CreateChild", "params": [params]})
|
39
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
40
|
+
try:
|
41
|
+
return response["result"]
|
42
|
+
except KeyError:
|
43
|
+
return response["error"]
|
26
44
|
|
27
45
|
def get_layout(self, handle):
|
28
46
|
"""
|
@@ -76,7 +94,7 @@ class EngineGenericObjectApi:
|
|
76
94
|
except KeyError:
|
77
95
|
return response["error"]
|
78
96
|
|
79
|
-
def get_hypercube_data(self, handle, path="/qHyperCubeDef", pages=
|
97
|
+
def get_hypercube_data(self, handle, path="/qHyperCubeDef", pages={}):
|
80
98
|
"""
|
81
99
|
Retrieves the data from a specific hypercube in a generic object.
|
82
100
|
|
@@ -89,14 +107,14 @@ class EngineGenericObjectApi:
|
|
89
107
|
dict: The data from the hypercube. In case of an error, returns the error information.
|
90
108
|
"""
|
91
109
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": handle, "method": "GetHyperCubeData",
|
92
|
-
"params":
|
110
|
+
"params": {"qPath": path, "qPages": [pages]}})
|
93
111
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
94
112
|
try:
|
95
113
|
return response["result"]
|
96
114
|
except KeyError:
|
97
115
|
return response["error"]
|
98
116
|
|
99
|
-
def get_hypercube_pivot_data(self, handle, path="/qHyperCubeDef", pages=
|
117
|
+
def get_hypercube_pivot_data(self, handle, path="/qHyperCubeDef", pages={}):
|
100
118
|
"""
|
101
119
|
Retrieves the pivot data from a specific hypercube in a generic object.
|
102
120
|
|
@@ -108,16 +126,15 @@ class EngineGenericObjectApi:
|
|
108
126
|
Returns:
|
109
127
|
dict: The pivot data from the hypercube. In case of an error, returns the error information.
|
110
128
|
"""
|
111
|
-
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": handle,
|
112
|
-
"
|
113
|
-
"params": [path, pages]})
|
129
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": handle, "method": "GetHyperCubePivotData",
|
130
|
+
"params": {"qPath": path, "qPages": [pages]}})
|
114
131
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
115
132
|
try:
|
116
133
|
return response["result"]
|
117
134
|
except KeyError:
|
118
135
|
return response["error"]
|
119
136
|
|
120
|
-
def get_hypercube_stack_data(self, handle, path="/qHyperCubeDef", pages=
|
137
|
+
def get_hypercube_stack_data(self, handle, path="/qHyperCubeDef", pages={}, max_no_cells=10000):
|
121
138
|
"""
|
122
139
|
Retrieves the values of a stacked pivot table. It is possible to retrieve specific pages of data.
|
123
140
|
|
@@ -132,7 +149,7 @@ class EngineGenericObjectApi:
|
|
132
149
|
dict: The pivot data from the hypercube. In case of an error, returns the error information.
|
133
150
|
"""
|
134
151
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": handle, "method": "GetHyperCubeStackData",
|
135
|
-
"params":
|
152
|
+
"params": {"qPath": path, "qPages": [pages], "qMaxNbrCells": max_no_cells}})
|
136
153
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
137
154
|
try:
|
138
155
|
return response["result"]
|
@@ -85,7 +85,8 @@ class EngineGlobalApi:
|
|
85
85
|
Returns:
|
86
86
|
dict: Information about the deletion result.
|
87
87
|
"""
|
88
|
-
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "DeleteApp",
|
88
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "DeleteApp",
|
89
|
+
"params": {"qAppId": app_name}})
|
89
90
|
response = json.loads(
|
90
91
|
self.engine_socket.send_call(self.engine_socket, msg))
|
91
92
|
try:
|
qe_api_client/engine.py
CHANGED
@@ -12,6 +12,12 @@ import pandas as pd
|
|
12
12
|
|
13
13
|
|
14
14
|
class QixEngine:
|
15
|
+
"""
|
16
|
+
The class of the client to interact with the Qlik Sense Engine API.
|
17
|
+
|
18
|
+
Methods:
|
19
|
+
select_in_dimension(app_handle, dimension_name, list_of_values): Selects values in a given field.
|
20
|
+
"""
|
15
21
|
|
16
22
|
def __init__(self, url, user_directory=None, user_id=None, ca_certs=None, certfile=None, keyfile=None, app_id=None):
|
17
23
|
self.url = url
|
@@ -33,112 +39,62 @@ class QixEngine:
|
|
33
39
|
self.structs = structs
|
34
40
|
self.app_handle = ''
|
35
41
|
|
36
|
-
def
|
37
|
-
|
38
|
-
|
39
|
-
return app['qAppId']
|
40
|
-
except KeyError:
|
41
|
-
return app['message']
|
42
|
-
|
43
|
-
def load_script(self, script):
|
44
|
-
self.eaa.set_script(self.app_handle, script)
|
45
|
-
return self.eaa.do_reload_ex(self.app_handle)['qResult']['qSuccess']
|
46
|
-
|
47
|
-
def open_app(self, app_obj):
|
48
|
-
opened_app = self.ega.open_doc(app_obj)
|
49
|
-
self.app_handle = self.ega.get_handle(opened_app)
|
50
|
-
return opened_app['qGenericId']
|
51
|
-
|
52
|
-
def create_hypercube(self, doc_handle, list_of_dimensions=[], list_of_measures=[], rows_to_return=1000):
|
53
|
-
no_of_columns = len(list_of_dimensions) + len(list_of_measures)
|
54
|
-
hc_dim = []
|
55
|
-
for d in list_of_dimensions:
|
56
|
-
hc_inline_dim = self.structs.nx_inline_dimension_def([d])
|
57
|
-
hc_dim.append(self.structs.nx_hypercube_dimensions(hc_inline_dim))
|
58
|
-
hc_mes = []
|
59
|
-
for m in list_of_measures:
|
60
|
-
hc_mes_sort = self.structs.nx_sort_by()
|
61
|
-
hc_inline_mes = self.structs.nx_inline_measure_def(m)
|
62
|
-
hc_mes.append(self.structs.nx_hypercube_measure(hc_mes_sort, hc_inline_mes))
|
63
|
-
nx_page = self.structs.nx_page(0, 0, no_of_columns, rows_to_return)
|
64
|
-
hc_def = self.structs.hypercube_def("$", hc_dim, hc_mes, [nx_page])
|
65
|
-
hc_response = self.eaa.create_object(doc_handle, "CH01", "Chart", "qHyperCubeDef", hc_def)
|
66
|
-
hc_handle = self.ega.get_handle(hc_response)
|
67
|
-
# self.egoa.get_layout(hc_handle)
|
68
|
-
hc_data = self.egoa.get_hypercube_data(hc_handle, "/qHyperCubeDef", [nx_page])
|
69
|
-
no_of_columns = len(list_of_dimensions)+len(list_of_measures)
|
70
|
-
return hc_data, no_of_columns
|
71
|
-
|
72
|
-
@staticmethod
|
73
|
-
def convert_hypercube_to_matrix(hc_data, no_of_columns):
|
74
|
-
rows = hc_data["qDataPages"][0]['qMatrix']
|
75
|
-
matrix = [[0 for x in range(no_of_columns)] for y in range(len(rows))]
|
76
|
-
for col_idx, row in enumerate(rows):
|
77
|
-
for cell_idx, cell_val in enumerate(row):
|
78
|
-
matrix[col_idx][cell_idx] = cell_val['qText']
|
79
|
-
return [list(i) for i in zip(*matrix)]
|
80
|
-
|
81
|
-
@staticmethod
|
82
|
-
def convert_hypercube_to_inline_table(hc_data, table_name):
|
83
|
-
rows = hc_data["qDataPages"][0]['qMatrix']
|
84
|
-
script = str.format('{0}:{1}Load * Inline [{1}', table_name, '\n')
|
85
|
-
inline_rows = ''
|
86
|
-
header_row = ''
|
87
|
-
for col_idx in range(len(rows[0])):
|
88
|
-
header_row = header_row + str.format('Column{0}{1}', col_idx, ',')
|
89
|
-
header_row = header_row[:-1] + '\n'
|
90
|
-
for row in rows:
|
91
|
-
for cell_val in row:
|
92
|
-
inline_rows = inline_rows + "'" + cell_val['qText'] + "'" + ','
|
93
|
-
inline_rows = inline_rows[:-1] + '\n'
|
94
|
-
return script + header_row + inline_rows + '];'
|
95
|
-
|
96
|
-
def select_in_dimension(self, dimension_name, list_of_values):
|
97
|
-
lb_field = self.eaa.get_field(self.app_handle, dimension_name)
|
98
|
-
fld_handle = self.ega.get_handle(lb_field)
|
42
|
+
def select_in_dimension(self, app_handle, dimension_name, list_of_values):
|
43
|
+
lb_field = self.eaa.get_field(app_handle, dimension_name)
|
44
|
+
fld_handle = self.get_handle(lb_field)
|
99
45
|
values_to_select = []
|
100
46
|
for val in list_of_values:
|
101
|
-
|
102
|
-
values_to_select.append(
|
47
|
+
fld_value = self.structs.field_value(val)
|
48
|
+
values_to_select.append(fld_value)
|
103
49
|
return self.efa.select_values(fld_handle, values_to_select)
|
104
50
|
|
105
|
-
def select_excluded_in_dimension(self, dimension_name):
|
106
|
-
lb_field = self.eaa.get_field(
|
107
|
-
fld_handle = self.
|
51
|
+
def select_excluded_in_dimension(self, app_handle, dimension_name):
|
52
|
+
lb_field = self.eaa.get_field(app_handle, dimension_name)
|
53
|
+
fld_handle = self.get_handle(lb_field)
|
108
54
|
return self.efa.select_excluded(fld_handle)
|
109
55
|
|
110
|
-
def select_possible_in_dimension(self, dimension_name):
|
111
|
-
lb_field = self.eaa.get_field(
|
112
|
-
fld_handle = self.
|
56
|
+
def select_possible_in_dimension(self, app_handle, dimension_name):
|
57
|
+
lb_field = self.eaa.get_field(app_handle, dimension_name)
|
58
|
+
fld_handle = self.get_handle(lb_field)
|
113
59
|
return self.efa.select_possible(fld_handle)
|
114
60
|
|
115
61
|
# return a list of tuples where first value in tuple is the actual
|
116
62
|
# data value and the second tuple value is that
|
117
63
|
# values selection state
|
118
|
-
def get_list_object_data(self, dimension_name):
|
119
|
-
lb_field = self.eaa.get_field(
|
120
|
-
fld_handle = self.
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
64
|
+
def get_list_object_data(self, app_handle, dimension_name):
|
65
|
+
lb_field = self.eaa.get_field(app_handle, dimension_name)
|
66
|
+
fld_handle = self.get_handle(lb_field)
|
67
|
+
|
68
|
+
nx_inline_dimension_def = self.structs.nx_inline_dimension_def([dimension_name])
|
69
|
+
nx_page = self.structs.nx_page(0, 0, self.efa.get_cardinal(fld_handle))
|
70
|
+
lb_def = self.structs.list_object_def("$", "", nx_inline_dimension_def,
|
71
|
+
[nx_page])
|
72
|
+
|
73
|
+
# Create info structure
|
74
|
+
nx_info = self.structs.nx_info("ListObject", "SLB01")
|
75
|
+
|
76
|
+
# Create generic object properties structure
|
77
|
+
gen_obj_props = self.structs.generic_object_properties(nx_info, "qListObjectDef", lb_def)
|
78
|
+
listobj = self.eaa.create_session_object(app_handle, gen_obj_props) # NOQA
|
79
|
+
listobj_handle = self.get_handle(listobj)
|
126
80
|
val_list = self.egoa.get_layout(listobj_handle)["qListObject"]["qDataPages"][0]["qMatrix"] # NOQA
|
127
81
|
val_n_state_list = []
|
128
82
|
for val in val_list:
|
129
83
|
val_n_state_list.append((val[0]["qText"], val[0]["qState"]))
|
130
|
-
return val_n_state_list
|
131
84
|
|
132
|
-
|
133
|
-
lb_field = self.eaa.get_field(self.app_handle, dimension_name)
|
134
|
-
fld_handle = self.ega.get_handle(lb_field)
|
135
|
-
return self.efa.clear(fld_handle)['qReturn']
|
85
|
+
return val_n_state_list
|
136
86
|
|
137
|
-
def
|
138
|
-
|
87
|
+
def clear_selection_in_dimension(self, app_handle, dimension_name):
|
88
|
+
lb_field = self.eaa.get_field(app_handle, dimension_name)
|
89
|
+
fld_handle = self.get_handle(lb_field)
|
90
|
+
return self.efa.clear(fld_handle)
|
139
91
|
|
140
|
-
def
|
141
|
-
|
92
|
+
def create_single_master_dimension(self, app_handle, dim_title, dim_def, dim_label):
|
93
|
+
nx_info = self.structs.nx_info("dimension")
|
94
|
+
lb_dim_def = self.structs.nx_library_dimension_def("N",[dim_def],[""],dim_label)
|
95
|
+
gen_dim_props = self.structs.generic_dimension_properties(nx_info, lb_dim_def, dim_title)
|
96
|
+
master_dim = self.eaa.create_dimension(app_handle, gen_dim_props)
|
97
|
+
return master_dim
|
142
98
|
|
143
99
|
def disconnect(self):
|
144
100
|
self.conn.close_qvengine_connection(self.conn)
|
@@ -163,23 +119,19 @@ class QixEngine:
|
|
163
119
|
except ValueError:
|
164
120
|
return "Bad handle value in " + obj
|
165
121
|
|
166
|
-
def get_chart_data(self,
|
122
|
+
def get_chart_data(self, app_handle, obj_id):
|
167
123
|
"""
|
168
124
|
Retrieves the data from a given chart object.
|
169
125
|
|
170
126
|
Parameters:
|
171
|
-
|
127
|
+
app_handle (int): The handle of the app.
|
172
128
|
obj_id (str): The ID of the chart object.
|
173
129
|
|
174
130
|
Returns:
|
175
|
-
|
176
|
-
|
177
|
-
Raises:
|
178
|
-
ValueError: If the handle value is invalid.
|
131
|
+
DataFrame: A table of the chart content.
|
179
132
|
"""
|
180
|
-
|
181
133
|
# Get object ID
|
182
|
-
obj = self.eaa.get_object(
|
134
|
+
obj = self.eaa.get_object(app_handle, obj_id)
|
183
135
|
if obj['qType'] is None:
|
184
136
|
return 'Chart ID does not exists!'
|
185
137
|
|
@@ -212,7 +164,7 @@ class QixEngine:
|
|
212
164
|
# Retrieves the hypercube data in a loop (because of limitation from 10.000 cells per call)
|
213
165
|
while no_of_rows > page * height:
|
214
166
|
nx_page = self.structs.nx_page(0, page * height, width, height)
|
215
|
-
hc_data = self.egoa.get_hypercube_data(obj_handle, '/qHyperCubeDef',
|
167
|
+
hc_data = self.egoa.get_hypercube_data(obj_handle, '/qHyperCubeDef', nx_page)[
|
216
168
|
'qDataPages'][0]['qMatrix']
|
217
169
|
data_values.extend(hc_data)
|
218
170
|
page += 1
|
@@ -242,7 +194,7 @@ class QixEngine:
|
|
242
194
|
# Gets the column headers for the pivot table
|
243
195
|
col_headers = []
|
244
196
|
nx_page_top = self.structs.nx_page(0, 0, width, 1)
|
245
|
-
hc_top = self.egoa.get_hypercube_pivot_data(obj_handle, '/qHyperCubeDef',
|
197
|
+
hc_top = self.egoa.get_hypercube_pivot_data(obj_handle, '/qHyperCubeDef', nx_page_top)[
|
246
198
|
'qDataPages'][0]['qTop']
|
247
199
|
for top_node in hc_top:
|
248
200
|
col_headers.extend(get_all_dimensions(top_node))
|
@@ -257,13 +209,13 @@ class QixEngine:
|
|
257
209
|
nx_page = self.structs.nx_page(0, page * height, width, height)
|
258
210
|
|
259
211
|
# Retrieves the row headers for the pivot table
|
260
|
-
hc_left = self.egoa.get_hypercube_pivot_data(obj_handle, '/qHyperCubeDef',
|
212
|
+
hc_left = self.egoa.get_hypercube_pivot_data(obj_handle, '/qHyperCubeDef', nx_page)[
|
261
213
|
'qDataPages'][0]['qLeft']
|
262
214
|
for left_node in hc_left:
|
263
215
|
row_headers.extend(get_all_dimensions(left_node))
|
264
216
|
|
265
217
|
# Retrieves the data for the pivot table
|
266
|
-
hc_data = self.egoa.get_hypercube_pivot_data(obj_handle, '/qHyperCubeDef',
|
218
|
+
hc_data = self.egoa.get_hypercube_pivot_data(obj_handle, '/qHyperCubeDef', nx_page)[
|
267
219
|
'qDataPages'][0]['qData']
|
268
220
|
for row in hc_data:
|
269
221
|
data_values.append([cell['qText'] for cell in row])
|
@@ -281,8 +233,8 @@ class QixEngine:
|
|
281
233
|
elif obj_layout['qInfo']['qType'] in ['barchart'] and obj_layout['qHyperCube']['qStackedDataPages'] != []:
|
282
234
|
max_no_cells = no_of_columns * no_of_rows
|
283
235
|
nx_page = self.structs.nx_page(0, 0, no_of_columns, no_of_rows)
|
284
|
-
hc_data = self.egoa.get_hypercube_stack_data(obj_handle, '/qHyperCubeDef',
|
285
|
-
|
236
|
+
hc_data = self.egoa.get_hypercube_stack_data(obj_handle, '/qHyperCubeDef', nx_page, max_no_cells)[
|
237
|
+
'qDataPages'][0]['qData'][0]['qSubNodes']
|
286
238
|
|
287
239
|
# Transform the nested structure into a flat DataFrame
|
288
240
|
data_values = []
|
@@ -297,5 +249,85 @@ class QixEngine:
|
|
297
249
|
else:
|
298
250
|
return 'Chart type not supported.'
|
299
251
|
|
252
|
+
# Returns the Dataframe
|
253
|
+
return df
|
254
|
+
|
255
|
+
def get_constructed_table_data(self, app_handle, list_of_dimensions = [], list_of_measures = [],
|
256
|
+
list_of_master_dimensions = [], list_of_master_measures = []):
|
257
|
+
"""
|
258
|
+
Creates a table from given fields, expressions, dimensions or measures and retrieves the data from it.
|
259
|
+
|
260
|
+
Parameters:
|
261
|
+
app_handle (int): The handle of the app.
|
262
|
+
list_of_dimensions (list): A list of dimensions.
|
263
|
+
list_of_measures (list): A list of measures.
|
264
|
+
list_of_master_dimensions (list): A list of master dimensions.
|
265
|
+
list_of_master_measures (list): A list of master measures.
|
266
|
+
|
267
|
+
Returns:
|
268
|
+
DataFrame: A table of the chart content.
|
269
|
+
"""
|
270
|
+
# Create dimension property
|
271
|
+
hc_dim = []
|
272
|
+
for dimension in list_of_dimensions:
|
273
|
+
hc_inline_dim_def = self.structs.nx_inline_dimension_def([dimension])
|
274
|
+
hc_dim.append(self.structs.nx_dimension("", hc_inline_dim_def))
|
275
|
+
for dimension in list_of_master_dimensions:
|
276
|
+
hc_dim.append(self.structs.nx_dimension(dimension))
|
277
|
+
|
278
|
+
# Create measure property
|
279
|
+
hc_mes = []
|
280
|
+
for measure in list_of_measures:
|
281
|
+
hc_inline_mes = self.structs.nx_inline_measure_def(measure)
|
282
|
+
hc_mes.append(self.structs.nx_measure("", hc_inline_mes))
|
283
|
+
for measure in list_of_master_measures:
|
284
|
+
hc_mes.append(self.structs.nx_measure(measure))
|
285
|
+
|
286
|
+
# Create hypercube structure
|
287
|
+
hc_def = self.structs.hypercube_def("$", hc_dim, hc_mes)
|
288
|
+
|
289
|
+
# Create info structure
|
290
|
+
nx_info = self.structs.nx_info("table")
|
291
|
+
|
292
|
+
# Create generic object properties structure
|
293
|
+
gen_obj_props = self.structs.generic_object_properties(nx_info, "qHyperCubeDef", hc_def)
|
294
|
+
|
295
|
+
# Create session object
|
296
|
+
hc_obj = self.eaa.create_session_object(app_handle, gen_obj_props)
|
297
|
+
|
298
|
+
# Get object handle
|
299
|
+
hc_obj_handle = self.get_handle(hc_obj)
|
300
|
+
|
301
|
+
# Get object layout
|
302
|
+
hc_obj_layout = self.egoa.get_layout(hc_obj_handle)
|
303
|
+
|
304
|
+
# Determine the number of the columns and the rows the table has and splits in certain circumstances the table calls
|
305
|
+
no_of_columns = hc_obj_layout['qHyperCube']['qSize']['qcx']
|
306
|
+
width = no_of_columns
|
307
|
+
no_of_rows = hc_obj_layout['qHyperCube']['qSize']['qcy']
|
308
|
+
height = int(math.floor(10000 / no_of_columns))
|
309
|
+
|
310
|
+
# Extract the dimension and measure titles and concat them to column names.
|
311
|
+
dimension_titles = [dim['qFallbackTitle'] for dim in hc_obj_layout['qHyperCube']['qDimensionInfo']]
|
312
|
+
measure_titles = [measure['qFallbackTitle'] for measure in hc_obj_layout['qHyperCube']['qMeasureInfo']]
|
313
|
+
column_names = dimension_titles + measure_titles
|
314
|
+
|
315
|
+
# Paging variables
|
316
|
+
page = 0
|
317
|
+
data_values = []
|
318
|
+
|
319
|
+
# Retrieves the hypercube data in a loop (because of limitation from 10.000 cells per call)
|
320
|
+
while no_of_rows > page * height:
|
321
|
+
nx_page = self.structs.nx_page(0, page * height, width, height)
|
322
|
+
hc_data = self.egoa.get_hypercube_data(hc_obj_handle, '/qHyperCubeDef', nx_page)['qDataPages'][0]['qMatrix']
|
323
|
+
data_values.extend(hc_data)
|
324
|
+
page += 1
|
325
|
+
|
326
|
+
# Creates Dataframe from the content of the attribute 'qText'.
|
327
|
+
df = pd.DataFrame([[d['qText'] for d in sublist] for sublist in data_values])
|
328
|
+
|
329
|
+
# Assign titles zu Dataframe columns
|
330
|
+
df.columns = column_names
|
331
|
+
|
300
332
|
# Returns the Dataframe
|
301
333
|
return df
|
qe_api_client/engine_helper.py
CHANGED
@@ -4,7 +4,7 @@ from qe_api_client.api_classes.engine_app_api import EngineAppApi
|
|
4
4
|
from qe_api_client.api_classes.engine_field_api import EngineFieldApi
|
5
5
|
from qe_api_client.api_classes.engine_generic_object_api import EngineGenericObjectApi
|
6
6
|
from qe_api_client.api_classes.engine_global_api import EngineGlobalApi
|
7
|
-
|
7
|
+
import qe_api_client.structs as structs
|
8
8
|
|
9
9
|
import pandas as pd
|
10
10
|
|
@@ -12,22 +12,22 @@ import pandas as pd
|
|
12
12
|
def getDataFrame(connection, appHandle, measures, dimensions, selections={}):
|
13
13
|
engineGlobalApi = EngineGlobalApi(connection)
|
14
14
|
# Define Dimensions of hypercube
|
15
|
-
hc_inline_dim =
|
15
|
+
hc_inline_dim = structs.nx_inline_dimension_def(dimensions)
|
16
16
|
|
17
17
|
# Set sorting of Dimension by Measure
|
18
|
-
hc_mes_sort =
|
18
|
+
hc_mes_sort = structs.sort_criteria()
|
19
19
|
|
20
20
|
# Define Measure of hypercube
|
21
|
-
hc_inline_mes =
|
21
|
+
hc_inline_mes = structs.nx_inline_measure_def(measures)
|
22
22
|
|
23
23
|
# Build hypercube from above definition
|
24
|
-
hc_dim =
|
25
|
-
hc_mes =
|
24
|
+
hc_dim = structs.nx_dimension(hc_inline_dim)
|
25
|
+
hc_mes = structs.nx_measure("", hc_inline_mes, hc_mes_sort)
|
26
26
|
|
27
27
|
width = len(measures) + len(dimensions)
|
28
28
|
height = int(math.floor(10000 / width))
|
29
|
-
nx_page =
|
30
|
-
hc_def =
|
29
|
+
nx_page = structs.nx_page(0, 0, width, height)
|
30
|
+
hc_def = structs.hypercube_def("$", [hc_dim], [hc_mes], [nx_page])
|
31
31
|
|
32
32
|
engineAppApi = EngineAppApi(connection)
|
33
33
|
hc_response = engineAppApi.create_object(appHandle, "CH01", "Chart", "qHyperCubeDef", hc_def) # NOQA
|
@@ -47,8 +47,8 @@ def getDataFrame(connection, appHandle, measures, dimensions, selections={}):
|
|
47
47
|
|
48
48
|
i = 0
|
49
49
|
while i % height == 0:
|
50
|
-
nx_page =
|
51
|
-
hc_data = engineGenericObjectApi.get_hypercube_data(hc_handle, "/qHyperCubeDef",
|
50
|
+
nx_page = structs.nx_page(0, i, width, height)
|
51
|
+
hc_data = engineGenericObjectApi.get_hypercube_data(hc_handle, "/qHyperCubeDef", nx_page) # NOQA
|
52
52
|
elems = hc_data["qDataPages"][0]['qMatrix']
|
53
53
|
|
54
54
|
df = pd.DataFrame()
|
qe_api_client/structs.py
CHANGED
@@ -1,81 +1,69 @@
|
|
1
|
-
def list_object_def(state_name="$", library_id="", field_defs=
|
2
|
-
|
3
|
-
if initial_data_fetch is None:
|
4
|
-
initial_data_fetch = []
|
5
|
-
if sort_criterias is None:
|
6
|
-
sort_criterias = []
|
7
|
-
if field_labels is None:
|
8
|
-
field_labels = []
|
9
|
-
if field_defs is None:
|
10
|
-
field_defs = []
|
11
|
-
return {"qStateName": state_name, "qLibraryId": library_id,
|
12
|
-
"qDef": {"qFieldDefs": field_defs, "qFieldLabels": field_labels, "qSortCriterias": sort_criterias},
|
1
|
+
def list_object_def(state_name="$", library_id="", field_defs=[], initial_data_fetch=[]):
|
2
|
+
return {"qStateName": state_name, "qLibraryId": library_id, "qDef": field_defs,
|
13
3
|
"qInitialDataFetch": initial_data_fetch}
|
14
4
|
|
15
|
-
|
16
5
|
def hypercube_def(state_name="$", nx_dims=[], nx_meas=[], nx_page=[], inter_column_sort=[0, 1, 2], suppress_zero=False,
|
17
6
|
suppress_missing=False):
|
18
|
-
return {"qStateName": state_name,
|
19
|
-
"
|
20
|
-
"
|
21
|
-
"
|
22
|
-
"
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
"
|
27
|
-
"qAlwaysFullyExpanded": False,
|
28
|
-
"qMaxStackedCells": 5000,
|
29
|
-
"qPopulateMissing": False,
|
30
|
-
"qShowTotalsAbove": False,
|
31
|
-
"qIndentMode": False,
|
32
|
-
"qCalcCond": "",
|
33
|
-
"qSortbyYValue": 0
|
34
|
-
}
|
35
|
-
|
36
|
-
|
37
|
-
def nx_hypercube_dimensions(dim_def):
|
38
|
-
return {"qLibraryId": "", "qNullSuppression": False, "qDef": dim_def}
|
39
|
-
|
40
|
-
|
41
|
-
def nx_inline_dimension_def(field_definitions=[], grouping='N', field_labels=[]):
|
42
|
-
return {"qGrouping": grouping,
|
43
|
-
"qFieldDefs": field_definitions,
|
44
|
-
"qFieldLabels": field_labels
|
45
|
-
}
|
46
|
-
|
47
|
-
|
48
|
-
def nx_hypercube_measure(sort_by={}, nx_inline_measures_def=""):
|
49
|
-
return {"qSortBy": sort_by,
|
50
|
-
"qDef": nx_inline_measures_def
|
51
|
-
}
|
52
|
-
|
53
|
-
|
54
|
-
def nx_sort_by(state=0, freq=0, numeric=0, ascii=0, load_order=1):
|
55
|
-
return {"qSortByState": state,
|
56
|
-
"qSortByFrequency": freq,
|
57
|
-
"qSortByNumeric": numeric,
|
58
|
-
"qSortByAscii": ascii,
|
59
|
-
"qSortByLoadOrder": load_order,
|
60
|
-
"qSortByExpression": 0,
|
61
|
-
"qExpression": {
|
62
|
-
"qv": ""
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
|
67
|
-
def nx_inline_measure_def(definition, label="",
|
68
|
-
description="",
|
69
|
-
tags=[],
|
70
|
-
grouping="N"
|
71
|
-
):
|
72
|
-
return {"qLabel": label,
|
73
|
-
"qDescription": description,
|
74
|
-
"qTags": tags,
|
75
|
-
"qGrouping": grouping,
|
76
|
-
"qDef": definition
|
77
|
-
}
|
7
|
+
return {"qStateName": state_name, "qDimensions": nx_dims, "qMeasures": nx_meas,
|
8
|
+
"qInterColumnSortOrder": inter_column_sort, "qSuppressZero": suppress_zero,
|
9
|
+
"qSuppressMissing": suppress_missing, "qInitialDataFetch": nx_page, "qMode": 'S', "qNoOfLeftDims": -1,
|
10
|
+
"qAlwaysFullyExpanded": False, "qMaxStackedCells": 5000, "qPopulateMissing": False,
|
11
|
+
"qShowTotalsAbove": False, "qIndentMode": False, "qCalcCond": "", "qSortbyYValue": 0}
|
12
|
+
|
13
|
+
def nx_inline_dimension_def(field_definitions=[], field_labels=[], sort_criterias=[], grouping='N'):
|
14
|
+
return {"qGrouping": grouping, "qFieldDefs": field_definitions, "qFieldLabels": field_labels,
|
15
|
+
"qSortCriterias": sort_criterias, "qReverseSort": False}
|
78
16
|
|
17
|
+
def nx_inline_measure_def(definition, label="", description="", tags=[], grouping="N"):
|
18
|
+
return {"qLabel": label, "qDescription": description, "qTags": tags, "qGrouping": grouping, "qDef": definition}
|
79
19
|
|
80
20
|
def nx_page(left=0, top=0, width=2, height=2):
|
81
21
|
return {"qLeft": left, "qTop": top, "qWidth": width, "qHeight": height}
|
22
|
+
|
23
|
+
def nx_info(obj_type, obj_id=""):
|
24
|
+
"""
|
25
|
+
Retrieves the data from a specific list object in a generic object.
|
26
|
+
|
27
|
+
Parameters:
|
28
|
+
obj_type (str): Type of the object. This parameter is mandatory.
|
29
|
+
obj_id (str): Identifier of the object. If the chosen identifier is already in use, the engine automatically
|
30
|
+
sets another one. If an identifier is not set, the engine automatically sets one. This parameter is optional.
|
31
|
+
|
32
|
+
Returns:
|
33
|
+
dict: Struct "nxInfo"
|
34
|
+
"""
|
35
|
+
return {"qId": obj_id, "qType": obj_type}
|
36
|
+
|
37
|
+
def nx_dimension(library_id="", dim_def={}, null_suppression=False):
|
38
|
+
return {"qLibraryId": library_id, "qDef": dim_def, "qNullSuppression": null_suppression}
|
39
|
+
|
40
|
+
def nx_measure(library_id="", mes_def={}, sort_by={}):
|
41
|
+
return {"qLibraryId": library_id, "qDef": mes_def, "qSortBy": sort_by}
|
42
|
+
|
43
|
+
def generic_object_properties(info, prop_name, prop_def, extends_id="", state_name="$"):
|
44
|
+
return {"qInfo": info, "qExtendsId": extends_id, prop_name: prop_def, "qStateName": state_name}
|
45
|
+
|
46
|
+
def sort_criteria(state=0, freq=0, numeric=0, ascii=0, load_order=1):
|
47
|
+
return {"qSortByState": state, "qSortByFrequency": freq, "qSortByNumeric": numeric, "qSortByAscii": ascii,
|
48
|
+
"qSortByLoadOrder": load_order, "qSortByExpression": 0, "qExpression": {"qv": ""}}
|
49
|
+
|
50
|
+
def field_value(text, is_numeric = False, number = 0):
|
51
|
+
return {"qText": text, "qIsNumeric": is_numeric, "qNumber": number}
|
52
|
+
|
53
|
+
def generic_dimension_properties(info, lb_dim_def, dim_title):
|
54
|
+
return {"qInfo": info, "qDim": lb_dim_def, "qMetaDef": {"title": dim_title}}
|
55
|
+
|
56
|
+
def nx_library_dimension_def(grouping="N", field_definitions=[], field_labels=[""], label_expression=""):
|
57
|
+
return {"qGrouping": grouping, "qFieldDefs": field_definitions, "qFieldLabels": field_labels,
|
58
|
+
"qLabelExpression": label_expression}
|
59
|
+
|
60
|
+
def nx_library_measure_def(label, mes_def, grouping="N", expressions=[], active_expression=0, label_expression="",
|
61
|
+
num_format={}):
|
62
|
+
return {"qLabel": label, "qDef": mes_def,"qGrouping": grouping, "qExpressions": expressions,
|
63
|
+
"qActiveExpression": active_expression, "qLabelExpression": label_expression, "qNumFormat": num_format}
|
64
|
+
|
65
|
+
def num_format(type="U", n_dec=10, use_thou=0, fmt="", dec="", thou=""):
|
66
|
+
return {"qType": type, "qnDec": n_dec, "qUseThou": use_thou, "qFmt": fmt, "qDec": dec, "qThou": thou}
|
67
|
+
|
68
|
+
def generic_measure_properties(info, lb_meas_def, meas_title):
|
69
|
+
return {"qInfo": info, "qMeasure": lb_meas_def, "qMetaDef": {"title": meas_title}}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
qe_api_client/__init__.py,sha256=bypB4CIjpHtf5Pu_NwtJajC69zqQD7qB9jo8cCX0B54,23
|
2
|
+
qe_api_client/engine.py,sha256=zK6FxdsxiFy3-IpZ664gcsoJU9dpTdVm4NWn6zgXa6E,14944
|
3
|
+
qe_api_client/engine_communicator.py,sha256=Va8Kz4cN6uyKLzV3JllBw08KbU4uDn8e-5pIm5Kmsfs,1291
|
4
|
+
qe_api_client/engine_helper.py,sha256=DSZR92-pGqklzki53QufgGr9tUTKKXZyF_fHEfXokTs,2382
|
5
|
+
qe_api_client/structs.py,sha256=9oB8-APCIkt1nNtwRpqGGMvzF42SX2ep5r4zSrLkjL4,3999
|
6
|
+
qe_api_client/api_classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
qe_api_client/api_classes/engine_app_api.py,sha256=3bQHufiKvWHOOKjX50WK7pbH-fM0Rz6WMblEgEjAn2I,36847
|
8
|
+
qe_api_client/api_classes/engine_field_api.py,sha256=zCLIR7rmxqwIrJYK_-uHVEhMvBcEP2qofuX8ZPygqCA,5479
|
9
|
+
qe_api_client/api_classes/engine_generic_dimension_api.py,sha256=1joTET6GWCTW-80wafrajLQuMyFwIPp0QKoILyLdP1U,1377
|
10
|
+
qe_api_client/api_classes/engine_generic_measure_api.py,sha256=zbRYRA99LQS9SY3QVgoUABqgVDRPwBQ8o2ZbESVEsHE,1321
|
11
|
+
qe_api_client/api_classes/engine_generic_object_api.py,sha256=nqsEtvKkt5XkUEIVUoBtNVXtmUvuifxrgTcw2fDuaOE,8218
|
12
|
+
qe_api_client/api_classes/engine_generic_variable_api.py,sha256=sWXZpE-GLfcMijmfORnDNrJ6lmXX3x5TRHlkEu_i0BQ,2027
|
13
|
+
qe_api_client/api_classes/engine_global_api.py,sha256=G6QQHI36WOo7W25zg4Uz__gMSLC2ptNTvbBdElPzgZI,27535
|
14
|
+
qe_api_client-2.2.0.dist-info/LICENSE,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
|
15
|
+
qe_api_client-2.2.0.dist-info/METADATA,sha256=ZvtVqTUoNFA_a70UPxJWIjUptydO1Ij42w5Yy_hF8B0,1995
|
16
|
+
qe_api_client-2.2.0.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
17
|
+
qe_api_client-2.2.0.dist-info/top_level.txt,sha256=m_43YagP8UtZgJHmZEfu0vlBNwt36M01-Qby2jByMnk,14
|
18
|
+
qe_api_client-2.2.0.dist-info/RECORD,,
|
@@ -1,18 +0,0 @@
|
|
1
|
-
qe_api_client/__init__.py,sha256=bypB4CIjpHtf5Pu_NwtJajC69zqQD7qB9jo8cCX0B54,23
|
2
|
-
qe_api_client/engine.py,sha256=jG4YYLI_CJChimp76wJamgChJ-55YDMisKzmuRbPrew,13589
|
3
|
-
qe_api_client/engine_communicator.py,sha256=Va8Kz4cN6uyKLzV3JllBw08KbU4uDn8e-5pIm5Kmsfs,1291
|
4
|
-
qe_api_client/engine_helper.py,sha256=PU29TYs3V9yF54_IWTHD4O2qSSW-bcaayqH1LCsGFOc,2400
|
5
|
-
qe_api_client/structs.py,sha256=vswDRzkH8YEG0v6GuFl6hXEnRaWkQzvnTBU1T_e1vkk,2813
|
6
|
-
qe_api_client/api_classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
qe_api_client/api_classes/engine_app_api.py,sha256=UtlB_ctSDZYMMiGmpiAU9jIyUPM4f2ybyK5i3bHpRRs,38423
|
8
|
-
qe_api_client/api_classes/engine_field_api.py,sha256=KiFhs2ev3S-92JklWzIVtfTEZ1oCiHEAanm1AXtV38s,4407
|
9
|
-
qe_api_client/api_classes/engine_generic_dimension_api.py,sha256=1joTET6GWCTW-80wafrajLQuMyFwIPp0QKoILyLdP1U,1377
|
10
|
-
qe_api_client/api_classes/engine_generic_measure_api.py,sha256=zbRYRA99LQS9SY3QVgoUABqgVDRPwBQ8o2ZbESVEsHE,1321
|
11
|
-
qe_api_client/api_classes/engine_generic_object_api.py,sha256=5pKcbti1tJSKLuacw-nXKMDXH-MlCNr12BoeE40F0OE,7311
|
12
|
-
qe_api_client/api_classes/engine_generic_variable_api.py,sha256=sWXZpE-GLfcMijmfORnDNrJ6lmXX3x5TRHlkEu_i0BQ,2027
|
13
|
-
qe_api_client/api_classes/engine_global_api.py,sha256=SdzhIP6Isco83xB1Y6y3LHKv-HjBTS_iMh-QdVYAl4g,27499
|
14
|
-
qe_api_client-2.0.0.dist-info/LICENSE,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
|
15
|
-
qe_api_client-2.0.0.dist-info/METADATA,sha256=OxDu8jkrUtxmLTUxYH-qBUNYdhTS46CpWPqAysK_CFM,1995
|
16
|
-
qe_api_client-2.0.0.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
17
|
-
qe_api_client-2.0.0.dist-info/top_level.txt,sha256=m_43YagP8UtZgJHmZEfu0vlBNwt36M01-Qby2jByMnk,14
|
18
|
-
qe_api_client-2.0.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|