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: all_handbook_content.txt
+80Lines changed: 80 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -14282,3 +14282,83 @@ It might be necessary to have **manual** PO number overwrite on header fields. I
14282
14282
]
14283
14283
}
14284
14284
```
14285
+
---
14286
+
title: Multiple data matching results
14287
+
slug: multiple-data-matching-results
14288
+
authors: [mrtnzlml]
14289
+
tags: [master-data-hub, rossum-formulas]
14290
+
---
14291
+
14292
+
import QuizComponent from '@site/src/components/QuizComponent';
14293
+
14294
+
Data matching (Master Data Hub; MDH) results are by default returned into an "enum" field in Rossum (also known as "Options" field). Enum field allows to select only one of the values returned (it behaves as a regular [HTML select element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/select) with options). What if you need to select multiple values, however?
14295
+
14296
+
<!-- truncate -->
14297
+
14298
+
The solution is to return all values into a **hidden** enum field and later process the data using a simple serverless function. In our example, the hidden field is `order_id_match`:
14299
+
14300
+
```python
14301
+
from txscript import TxScript, default_to, substitute
14302
+
14303
+
14304
+
def rossum_hook_request_handler(payload):
14305
+
x = TxScript.from_payload(payload)
14306
+
14307
+
# Do not recalculate if the input data has not changed
14308
+
# (add more fields depending on the input into your MDH query):
1. Get all valid options from the `order_id_match` enum field.
14340
+
2. Clear the existing `order_id_lines` table (our destination).
14341
+
3. Insert the enum values into the `order_id_lines` destination table.
14342
+
14343
+
Additionally, it takes care of recalculating the table lazily so users can update the final table manually if needed (see the `recalculate_hash` field).
14344
+
14345
+
This way, all data matching results were populated into multivalue table despite the data matching supporting only enum fields.
14346
+
14347
+
Note that it might be a good idea to lazily load additional values in the table. In real-world solution, the chain of hooks would look like this:
This way, we can distribute only row IDs from the first MDH extension and load the actual data in the second MDH extension. Alternatively, we could populate all the data in the first MDH hook. That is however a bit laborious when there are many columns to populate and distribute.
14356
+
14357
+
<QuizComponent
14358
+
question="Can master data hub extension return values to a string field?"
14359
+
answers={[
14360
+
{ text: 'Yes, MDH can return values into any preconfigured field' },
14361
+
{ text: 'No, only enum fields are supported', isCorrect: true }
14362
+
]}>
14363
+
The only field type that Master Data Hub (MDH) extension supports are `enum` fields. Enum fields limit the section to only one specific value. However, we can still access all the values (options) using the `x.field.order_id_match.attr.options` code which can later be distributed into a multivalue table.
0 commit comments