# How to select the policy number based on the logic

Hi All,

I am working on a web automation in a portal.
The inputs will be Date of birth of persons and their policy number( in this portal only 9 or 11 digits is acceptable if we enter numbers other than 9 digits or 11 digits number mean a pop up will come like only 9 or 11 policy number is acceptable )

“If the number is contains greater greater than or equal to 10 digits and less than 11 digits I need add a leading to make 11 digits policy numbers and need to proceed with further process.”

“If incase the digits contains less than or equals to 9 digits means:
first I need to convert into 9 digits number then need to check whether the patient details is present or not if present then I need to proceed with further process i.e scrapping the patient details.
If the patient details are not found for 9 digits then I need to convert the number into 11 digits policy numbers to scrap the data of patient details and store the scrapped data in a excel”
Incase for the cases 9 digits and 11 digits the patient details is not means even after adding leading zeros then I need to update in excel as no patient info found.

Please anyone help me to by giving a logic.

1 Like

Assuming you have an int variable,

``````If(intVar.ToString.Length <= 9, intVar.ToString("D9"), intVar.ToString("D11"))
``````

If your current var is a string,

``````If(strVar.Length <= 9, CInt(strVar).ToString("D9"), CInt(strVar).ToString("D11"))
``````

The above statement can be utilised in an assign or directly in Type into action

Hope this helps

Thanks
#nK

1 Like

@HeartCatcher

1. First check PolicyNumber length is less than 9 or not.
If PolicyNumber.Trim.Length <= 9
Then:
Check into application. If its found then continue next steps else
Check into application. If its found then continue next steps else invalid number
Else:
Check into application. If its found then continue next steps else invalid
1 Like

1 Like

Can you please create a sample workflow and send me,
I used a one if condition like:

what to do next

Actually first I need to check for 9 digits number whether the patient details will available or not after adding the leading zeros to make it 9 digits policy number, if details found then i need to scrap the data, if not I need to add leading zeros to make 11 digits then check the patient info if found then I need to scrap the data,
if not found in the both cases then I need to mention in the output as “No patient info found”.

@HeartCatcher