I am exploring a POC where I need to modify the ExtractionResult (retrieved from Data Extraction Scope), and post modifying the text, need to convert back to ExtractionResult variable Type.
The example is as below.
I am using a Regex extractor to extract one field (Currency), and if the field doesn’t exist / not extracted on the invoice, I want to have a default value for the field.
And I want to avoid a situation where the invoice goes to Human Validation (Action Center) because of the particular field not being extracted.
Is there a way to default a regex-based extractor value to a particular value (if the returned expression value is NULL/ Blank)?
If not, How can we modify the ExtractionResults output of the Data Extraction Scope and post modifying, change the text back to ExtractionResult variable Type?
My suggestion is to have a pre-validation logic before going to action center. if the values not extracted from the pdf, assign the default values to that variable and reroute to Action center if necessary. this way you can achieve your goal. Hope this helps, cheers!
I hope you have faced the same issue in the post, so before sending to Action center include a pre-validation step to evaluate the fields that is been extracted, if any value to be defaulted you can assign those variables and satisfy the condition. Drop a logic to have a flag set based on your pre validation steps. if that flag is true, send it to Action center. If not redirect to the next step without going to action center. Hope this clarifies.
Were you able to resolve this? Even I have a similar requirement, although I dont need to edit the result. My results data table would be coming in from a python activity and I need to transform that into an ExtractionResults object that I can then send to the Present Validation Station Activity to validate and overwrite results from the station itself.
Right after the data is extracted (from any extraction method), we do some validation checks to see whether we need to go for manual verification or not. This includes some steps where we update the ExtractedResult variable values. This is done just by accessing the field values using a code as shown below.
The Field() refers to the field you want to check. This comes in the order you define in the taxonomy.
Also, there can be multiple values extracted for a given field. Hence you see Values(). So you can select the default value as I have done and access the value of the field. The same code can be used to update the values if needed.
This also enables you to access other properties of the fields like the confidence in case you want to use it for your validation step.
Once you have done this, we can directly pass that onto other steps as needed.
In case you really want to convert this variable into another, use JSON serializing. Afterall, this whole structure is a JSON.
How can I assign a value when the result value returns null? We can’t use ExtractionResults.ResultsDocument.Fileds(0).Values(0).Value = “Your Value” when the values are null.
Sometimes robots cannot extract the relevant field values and returns null. But I want to assign a default values to the field-values that return null. I think I need to create new “fields.values” array . Do you have any idea on this subject? How can I create it ?
As an argument of SetValue method use the new ResultsValue object (there are a lot of constructors, use the simplest one). In my example (binary field) I use “yes” as value, nothing as ResultContentReference, and 1 for confidence levels