IF based on element Exists

After typing on my Search box we get user details-
image

We get few option as listed below in screen as output :-

    • only 1 user is available with the search and we see below screen
      image

3)- If we don’t find any user against our search then we see below screen
image

So now I have to look for logic/activity with which I could respond based on my search result.
if the user is available like in screen 1 I have to do couple of steps .
if output is multiple results like screen 2 we have to do couple of steps.
if the Output is like screen 3 then we have to do couple of steps .
can someone guide me the steps .
Thanks in advance

@shashank_dullu

Step1:
You can check if the “User ID:” element exists or not.
If it does, execute your “1 search result” steps here.
If not, try Step 2

Step2:
Read the screen using data scraping.
Save value in a datatable variable.
If length of datatable is > 0, that means you have multiple search results. Execute your “multiple search results” steps here.

If length of datatable = 0, means no search results. Execute your “no search results” steps here.

Can you explain with activity or view to clarify what you are saying

These are basic activities. Have you done the free UiPath training? It covers this kind of thing.

Yup, basic steps as @postwick mentions.
Training would be very helpful!

Here is a flow for your reference:

You don’t do “userFound = False” in the condition. userFound is a boolean so its value is either True or False. Get rid of “= False” and swap the activities in your Then and Else.

True that! Or, with the existing flow, you can use “Not userFound”!

That kind of logic is confusing for people trying to decipher your code later. Keep it simple.

That depends on your preference - I don’t feel “NOT” is hard to decipher. For me it is more convenient to read the bigger piece of following code in IF and the smaller part in ELSE. Could also be the sunny day in IF and so on.

@postwick - I have completed all the training .
@sumitd - I have tried these same thing but not able to achieve the expected results .
On the basis of search I will be getting three set of results So how can I handle 3 set of result to read Elements to iterate through if Loop . Right now the Element exists out can be Boolean result but with that I cant achieve that the right thing. ANy other activity Apart form Element Exists

Hi @shashank_dullu

Have a look on the skeleton of your query

ElementExistFlow.xaml (10.6 KB)

Regards
Gokul

@Gokul001 - Can you tell me about the dependencies used as first 3 activities are missing.

HI @shashank_dullu

Go to Manage Package → Install the → Uipath.Uiautomation.Activities

Regards
Gokul

I am using version 2019 I have used UIautomation dependencies but still I am not able to see

That is the Element Exist Activity you keep it by yourself @shashank_dullu