How to edit the ExtractionResult (extracted from Data Extraction Scope) and post editing, need to convert back to ExtractionResult Variable type

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?

3 Likes

Did you manage to find a solution? I also need to know how to convert the collection of DataTable back to ExtractionResult variable.

Any solution or suggestions available for this?

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!

did you find a solution for that ? or its not a valid option

@Dina.abdelhakam - same issue? Did you tried Out my suggestion?

I didnt get your point.

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.

Hi Chaithanya

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.

Thanks
Varun

Hi Chantanya, Did you find any solution for this? Please share if you have

Hello @satish.goru

What I usually do is this…

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.

AutoExtractionResults.ResultsDocument.Fields(0).Values(0).Value = "Your Value"

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.

Hope this helps

Hello Lahiru,

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 ?

It is easy to change existing value, but creating new one is much more complicated.
This is how this ResultValue object looks like:

As you see it is not only the value itself, but also a lot of different data like confidences and references to the document (region, size etc).

If you want to create value for single field, use SetValue method to the field object:

objExtractionResults.ResultsDocument.Fields.FirstOrDefault(function(x) x.FieldId.Equals("NoGroup.NoCategory.REMI.correctamount")).SetValue(new ResultsValue("Yes",nothing,1,1))

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

1 Like

Hello,
how would you do if you needed to initiate a datatable for one of the fields?