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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Which operator between...
Power Automate
Unanswered

Which operator between the oprands is suitable

(0) ShareShare
ReportReport
Posted on by 75

Hi Everyone,

I have a table with IDs in first column and edit buttons in second column, when i try to compare using equal to (=) it is giving the result not found, when i use "Contains it works as shown in the screen shot, But when the Id has only numbers this picks up the wrong value , Example when i search for Id_1234, it picks up 1234a if it appears first in the id column as Id_1234 is contained in 1234a. Pl find the data and the if condition.

ID Details
ID_1234aEdit
ID_1234Edit
Id_1223Edit
Id_1223bEdit
Id_5341aEdit
Id_5341Edit
Id_5341bEdit

bensat2_0-1712287467224.jpeg

Note: when i put Operator as Equal to its not picking up

I have the same question (0)
  • Deenuji_Loganathan_ Profile Picture
    6,250 Super User 2025 Season 2 on at

    @bensat2 

    We need to utilize the "equals" operator correctly, as "contains" is not suitable for your specific scenario.

     

    Please refer to the following flow, where you can observe my datatable consisting of "ID" and "Details" columns. I iterate through them using a "for each" loop and within the "if" condition, I specify the current item with the column details (ID) and then check it against the required values. This approach is functioning effectively.

     

    Deenuji_0-1712288408026.png

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

     
     
  • bensat2 Profile Picture
    75 on at

    ve tried that it returns blank though Id_1234 is there. 

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

    Hi @bensat2 ,

     

    Please find the attached solution. I have created a solution for Both Equal and Contains Operators.

     

    1.Equal Operator.

     

    VishnuReddy1997_0-1712307634023.png

     

    Code:

     

    Variables.CreateNewDatatable InputTable: { ^['ID', 'Details'], [$'''ID_1234a''', $'''Edit'''], [$'''ID_1234''', $'''Edit'''], [$'''Id_1223''', $'''Edit'''], [$'''Id_1223b''', $'''Edit'''], [$'''Id_5341a''', $'''Edit'''], [$'''Id_5341''', $'''Edit'''], [$'''Id_5341b''', $'''Edit'''], [$'''id_1234''', $'''Edit'''], [$'''Id_1234''', $'''Edit'''] } DataTable=> DataTable
    LOOP FOREACH CurrentItem IN DataTable
     Text.ChangeCase Text: CurrentItem[0] NewCase: Text.CaseOption.UpperCase Result=> ID
     IF ID = $'''ID_1234''' THEN
     Display.ShowMessageDialog.ShowMessage Message: $'''YES''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed6
     END
    END

     

    2. Contains

    VishnuReddy1997_1-1712307734794.png

     

    Code:

    Variables.CreateNewDatatable InputTable: { ^['ID', 'Details'], [$'''ID_1234a''', $'''Edit'''], [$'''ID_1234''', $'''Edit'''], [$'''Id_1223''', $'''Edit'''], [$'''Id_1223b''', $'''Edit'''], [$'''Id_5341a''', $'''Edit'''], [$'''Id_5341''', $'''Edit'''], [$'''Id_5341b''', $'''Edit'''], [$'''id_1234''', $'''Edit'''], [$'''Id_1234''', $'''Edit'''] } DataTable=> DataTable
    LOOP FOREACH CurrentItem IN DataTable
     Text.ChangeCase Text: CurrentItem[0] NewCase: Text.CaseOption.UpperCase Result=> ID
     IF Contains(ID, $'''ID_1234''', False) THEN
     Display.ShowMessageDialog.ShowMessage Message: $'''YES''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed6
     END
    END

     

    If you need further help, just let me know.

     

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

     

    Thanks & Regards

    Vishnu Reddy

  • Deenuji_Loganathan_ Profile Picture
    6,250 Super User 2025 Season 2 on at

    @bensat2 

     

    It seems like you might be experiencing an issue with the text case or there might be some extra whitespace in your variable.

     

    Let's tweak the logic slightly as follows: convert both "firstvalue" and "secondvalue" to lowercase, trim them, and then compare. This adjustment should ensure we don't miss anything this time! 🙂

     

    Still I won't recommend contains for this use case it may create some mess when you dealing some close values.

    Deenuji_0-1712308668083.png

    Code:

     

     

     

     

    SET DataTable TO { ^['ID', 'Details'] }
    Variables.AddRowToDataTable.AppendRowToDataTable DataTable: DataTable RowToAdd: ['ID_1234a', 'Edit']
    Variables.AddRowToDataTable.AppendRowToDataTable DataTable: DataTable RowToAdd: ['ID_1234', 'Edit']
    Variables.AddRowToDataTable.AppendRowToDataTable DataTable: DataTable RowToAdd: ['Id_1223', 'Edit']
    Variables.AddRowToDataTable.AppendRowToDataTable DataTable: DataTable RowToAdd: ['Id_1223b', 'Edit']
    Variables.AddRowToDataTable.AppendRowToDataTable DataTable: DataTable RowToAdd: ['Id_5341a', 'Edit']
    Variables.AddRowToDataTable.AppendRowToDataTable DataTable: DataTable RowToAdd: ['Id_5341', 'Edit']
    Variables.AddRowToDataTable.AppendRowToDataTable DataTable: DataTable RowToAdd: ['Id_5341b', 'Edit']
    LOOP FOREACH CurrentItem IN DataTable
     SET CurrentItemID TO CurrentItem['id']
     Text.ChangeCase Text: CurrentItemID NewCase: Text.CaseOption.LowerCase Result=> CurrentItemID
     SET Comparetext TO $'''ID_1234a'''
     Text.ChangeCase Text: Comparetext NewCase: Text.CaseOption.LowerCase Result=> Comparetext
     IF CurrentItemID.Trimmed = Comparetext.Trimmed THEN
     Display.ShowMessageDialog.ShowMessage Title: $'''info''' Message: $'''note''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
     END
    END

     

     

     

     

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

     
     
     
     
  • bensat2 Profile Picture
    75 on at

    Thanks Vishnu Will try out and let you know

  • Deenuji_Loganathan_ Profile Picture
    6,250 Super User 2025 Season 2 on at

    Hi @bensat2 

    Any progress regarding this matter? Have the suggestions from community members resolved your concerns? I've noticed you've initiated several discussions on various topics, and after receiving responses either from community members or by resolving them yourself, you've left those threads active instead of marking them as resolved. I would kindly encourage you to mark threads as resolved once your issue is addressed or if you receive a helpful response from community members. This not only assists future seekers but also encourages those who contribute to the forum.

  • bensat2 Profile Picture
    75 on at

    i solved the above using if conditions, though not desirable as the number of actions increase substanially

  • bensat2 Profile Picture
    75 on at

    sorry for the delayed reply

  • Deenuji_Loganathan_ Profile Picture
    6,250 Super User 2025 Season 2 on at

    @bensat2 

     

    After resolving your issue, kindly post the solution you followed and mark it as the solution for the respective topic. If you found a solution based on a suggestion from a community member, please mark that suggestion as the solution. This practice helps in closing the thread appropriately and provides valuable assistance to future seekers. We kindly request you to continue this practice for all topics you raise. Thank you.

     

    Please be advised that this applies to all topics you've raised in the past few weeks.


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

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

    Hi @bensat2 ,

     

    Please post the screenshot of the flow how you solved the issue and mark it as a solution,So it will help others in the future.

     

    Regards,

    Vishnu Reddy

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard