web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Answered

AND STATEMENT

(1) ShareShare
ReportReport
Posted on by 4

Hi Guys

 

I have two lists which has 1 column(Item) and 1 row and value as 'yes'. while using AND statement in IF condition to check both the rows in 2 lists the statement is not working.

ex: %List1[0] ='yes' AND List2[0] = 'yes'%

equals TRUE.

Zero is the row.

This condition is going to else even though yes is present in both lists,but while checking for variables it is working.

ex: %Var1 = 'yes' AND Var2= 'Yes'% equals TRUE. 

 

Any comments??

I have the same question (0)
  • eetuRobo Profile Picture
    4,535 Super User 2026 Season 1 on at

    Can you share screenshots of the flow and the lists values?
    Your condition seems fine to me and works:

    eetuRobo_0-1720145469081.png


    Check that the values are same capitalization in the list as in the condition (so in the list they should be no capitalization 'yes').

  • NathanAlvares24 Profile Picture
    1,714 Moderator on at

    Hi @Alayaan !

     

    How have you initialized your lists, List1 and List2? Like in a "Set variable" action like this:

    NathanAlvares24_0-1720145666745.png

     

    If yes, did you notice after clicking the save button, it will not store the value as yes but instead it stores as True. Because PAD recognizes simple yes (i.e. without single quotes) as a bool value.

    NathanAlvares24_1-1720145902732.png

     

    You need to store the value yes like this:

    NathanAlvares24_2-1720145944720.png

     

    %['yes']%

     

     

    The values should always be encapsulated within the single quotes as that treats that value as a string.

     

    The same also applies when you store it in a list using "Create list" action and "Add item to list" action. But here it will be a simple yes without the single quotes. And also without the pair of % signs at the start and end.

    NathanAlvares24_0-1720146189575.png

     

    If you were to put this yes between % signs, then it would end up as a bool value like this:

    NathanAlvares24_1-1720146392529.png

    NathanAlvares24_2-1720146403450.png

     

    I hope this helps.

  • Gany Profile Picture
    9 on at

    Hi, This is Alayaan from another account. Currently I don't have the image, we changed the logic. But I followed the exact method shown and checked for everything including capital letters. The values in the list are run time values that were extracted from web page. Other than that everything looks same as yours. I also tried setting the list value to the variable, just in case to check the whether the list is initialized or not, but that was also working fine. Anyways, Thank you.

  • Gany Profile Picture
    9 on at

    Hi Nathan,

    Those were run time values.

  • VishnuReddy1997 Profile Picture
    2,656 Super User 2026 Season 1 on at

    Hi @Alayaan ,

     

    May be the case issue.Please try the below solution.

    VishnuReddy1997_0-1720162939570.png

     

    Code:

    Variables.CreateNewList List=> List1
    Variables.AddItemToList Item: $'''yes''' List: List1
    Variables.CreateNewList List=> List2
    Variables.AddItemToList Item: $'''Yes''' List: List2
    IF (List1[0].ToUpper = 'YES' AND List2[0].ToUpper = 'YES') = $'''TRUE''' THEN
     Display.ShowMessageDialog.ShowMessage Message: List1[0].ToUpper = 'YES' AND List2[0].ToUpper = 'YES' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed9
    ELSE
     Display.ShowMessageDialog.ShowMessage Message: $'''NO''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed9
    END

     

    (Note:- if you got your solution you can mark as solution and gives kudos)


    Thanks & Regards

    Vishnu Reddy

  • eetuRobo Profile Picture
    4,535 Super User 2026 Season 1 on at

    Are the list1 and list2 variables actually list types and not datatable? Since you said you extract the values from webpage first thing I  think of is "Extract data from web page" -action which usually creates a datatable variable and if that has more columns than one (even if other columns rows are empty) then you should also refer to the column index or name.
    So does the List1 and List2 have (List) as the type when you open it or (Datatable) as shown in the below image?

    eetuRobo_0-1720162869109.png


    So if its always the first column and first row
    try:
    %List1[0][0] = 'yes' AND List2[0][0] = 'yes'%

    eetuRobo_0-1720163217173.png

     

  • Gany Profile Picture
    9 on at

    Hi, Posted a screenshot. It is a list only.

    Gany_0-1720164241330.png

     

  • eetuRobo Profile Picture
    4,535 Super User 2026 Season 1 on at

    Your screenshot seems to be broken.

    eetuRobo_0-1720164990740.png

     

    Can you reupload it

    EDIT: now its fixed

  • Verified answer
    eetuRobo Profile Picture
    4,535 Super User 2026 Season 1 on at

    You don't have any actions inside the condition. Just comments. So it might seem like it doesn't find the condition true even though it is. It just doesn't go in in since there are no actions to perform.
    Try adding just simple dummy set variable -actions to see if the condition is true or not.

    eetuRobo_0-1720165490853.png

     

  • Gany Profile Picture
    9 on at

    Hi,

    Thanks bro. It worked. Lol.. we were trying this since yesterday but never noticed.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 796

#2
Valantis Profile Picture

Valantis 568

#3
Haque Profile Picture

Haque 538

Last 30 days Overall leaderboard