Multiple If Statements for Values in PDF document

Hi everyone,

I want to know whether there is a better of more efficient solution.

I made a workflow that scans a PDF document with OCR. The output is checked for values with an IndexOf. I check for the ordernumber “Ordernummer”. However, the PDF documents are in multiple languages (dutch, german, english and french). So if not found “Ordernummer” it returns “-1”. In that case, I want to check for the german word “kundenr”. If not found, then check for the next language. And so on… I now have multiple If statements in other If statements.

Is there a better solution for this?

Cheers,
Joris

1 Like

@jorisveldt - We can try with Regex’s OR condition as shown below…

3 Likes

Hi Joris,

We can use loop here

  1. Make an array
  2. Stores the “OrderNumber” in different languages
  3. Then we can iterate cross matching with one IF condition inside

Hope this makes sense

Regards,
Shaf

1 Like

Thanks!
But I used regex already with string manipulation:

System.Text.RegularExpressions.Regex.Replace(output.Substring(output.IndexOf(“Order”), 18), “\D”, “”)

I tried your OR solution but seems impossible in this case. Or am I missing something?

Thanks!
I tried but I had difficulties to place the variable within this code:

System.Text.RegularExpressions.Regex.Replace(output.Substring(output.IndexOf(“Order”), 18), “\D”, “”)

“Order” should be replaced with item in array. But I have difficulties to put a variable within the regex.

1 Like