Compare count of variables doesn't work

I have PDF files that I read in Text and OCR. Then I count the words of both in different variables. This goes fine. Then I want to compare the two counts in an IF. If the text is larger dan the OCR than write the file to text.txt else write file to OCR.txt.
This is what doesn’t work: condition in the IF sExtractedOCR.Split(" “c).Count<sExtractedText.Split(” "c).Count.
All the texts are written to text.txt file while I have one file that should write to OCR.txt.

I hope someone can help me with this?
Kind regards

Hi @jose.disseldorp
welcome to forum
did u check the count of both using writeline before applying if condition?

Yes I did. See attached.
Count

can u show the values u are getting ?

Yes I can, thank you for helping me.
As you can see there should be one to go to OCR.txt and the others should be Text.txt

Do you have a solution for me?

@jose.disseldorp - Could you please print the count inside the Then and Else condition to see what count it is getting…

Thank you Prasath17 :wink:

The counts of the different PDF’s are in the print screen above. Each document has 3 lines in the output 2 with counts for Text and OCR and the third the choice to use text or OCR. The decision which one of the to to use.
I have 1 document that needs to be to OCR. That has Tekst: 91 and OCR 446. All the other documents should be “Use Text” instead of OCR. As you can see all of the outcome is to OCR. That is not right.

I hope this is clear for you? Please let me know.

Kind regards

@jose.disseldorp - Yes i see what is happening…

I just tried the same and it is working for me…

Is it possible if you could share your xaml(if you don’t have any sensitive info)…and possibly with some test data too…

Herewith I send my xaml and 3 PDF’s with no serieus data.

I hope you can find my problem

Kind regards
UitvraagProblemCount.xaml (9.5 KB) Moet voor tekst kiezen.pdf (44.9 KB) TestTekst.pdf (148.9 KB) Wat is Lorem Ipsum.pdf (37.7 KB)

@jose.disseldorp - Here you go…Issue has been fixed…

Reason: Inside the Microsfoft OCR , you have used the sExtractedText again…this is the same variable which was used in the previous read activity…

After fixing this, ran the workflow again…and here is the result.

Hope this helps…

Thank you very much. That was the solution!

Kind regards,
José

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.