I am automating different types of PDF files. Based on the Page title, reading content will change. Currently, I am using Nested if for this.
In IF activity, am writing following expression: PDFText.Contains(“Export Bill Realisation - Advice”) and in else part PDFText.Contains(“Debit - Advice”) and so on… and also am getting exact solution by this approach but there are total of 15 types of PDF files. If I will follow this approach then I have to write 15 IF activities one inside another.
Is it possible to convert it to Switch activity ? If yes, what I have to write in expression field and cases. Could you please help me in this.
For this approach, which one is better Nested IF or switch ?
Use Invoke Code activity, and write the if else logic inside this activity and assign the matching string to one variable.
E.g.,
If( PDFText.Contains(“Export Bill Realisation - Advice”))Then strvar = “Export Bill Realisation - Advice”
Else
'statement(s) will execute if the Boolean expression is false
…
…
…
End If
Let say, after invoke code activity, you have a matched string in strvar
In this case you need just code to assign the right string. It improves your workflow readability.
Because we don’t need if else activities in the main workflow.
I want to repeat some task based on two conditions. 1 is if the element exist is true and the other one is if attempts<3. For that I have written the following code but the inner if is getting executed only once. Can you please suggest why it is happening
attempts=0
bool=element exist?
if
{bool=true
then
if
{ atempts<3
then else{end execution}
re execute
attempts=attempts+1
}
Sorry!! My bad… it completely wend out of mind that if loop doesn’t repeat itself.
I used while loop to repeat the process and then followed it by a if loop. It worked…