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 Apps / IF condition not working
Power Apps
Unanswered

IF condition not working

(0) ShareShare
ReportReport
Posted on by

any correction required in below code, it showing error as invalid arugument type ,expecting boolean.

 

 

If(LookUp(
'backup',
Title =TextInput2.Text),

Patch(
'backup',
LookUp(
'backup',
Title = TextInput2.Text),
{Title: TextInput2.Text},
{Source: TextInput3.Text}

),
Patch(
'backup',
Defaults('backup'),
{Title: TextInput2.Text},
{Source: TextInput3.Text}
)

)

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @venky232 ,

    That is because you need to test the top statement with IsBlank, but try this

    With(
     {
     wID:
     LookUp(
     'backup',
     Title = TextInput2.Text
     ).ID
     },
     Patch(
     'backup',
     If(
     IsBlank(wID),
     Defaults('backup'),
     {ID: wID}
     ),
     {
     Title: TextInput2.Text,
     Source: TextInput3.Text
     }
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

     

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at
    //untested - adjust as needed
    
    With
    (
     {
     _myRecord
     ,LookUp
     (
     'backup'
     ,Title =TextInput2.Text
     )
     }
     ,If
     (
     !IsBlank
     (
     _myRecord
     ,Patch
     (
     'backup'
     ,{
     ID:_myRecord.ID
     ,Title:TextInput2.Text
     ,Source:TextInput3.Text
     }
     )
     ,Patch
     (
     'backup'
     ,{
     Title:TextInput2.Text
     ,Source:TextInput3.Text
     }
     )
     )
     )
     
    )
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @venky232 Possibly better version:

     

     

    //untested - adjust as needed
    
    With
    (
     {
     _myRecord
     ,LookUp
     (
     'backup'
     ,Title =TextInput2.Text
     )
     }
     ,Patch
     (
     'backup'
     ,{
     ID:If(!IsBlank(_myRecord,_myRecord.ID,Blank())
     ,Title:TextInput2.Text
     ,Source:TextInput3.Text
     }
     )
     
     
     
    )

     

     


    If any problem with the above, try this below:

    Check if turning on the formula-level error management setting helps with any issue:

     

    1. Click Settings

    2. Click Upcoming Features

    3. Toggle the Formula-level error management setting to On

    Then just close the modal, see if it works.

     

    poweractivate_0-1664838760107.png

     

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard