Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

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:
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at
    Re: IF condition not working

    @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

     

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at
    Re: IF condition not working
    //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
     }
     )
     )
     )
     
    )
  • Verified answer
    WarrenBelz Profile Picture
    146,524 Most Valuable Professional on at
    Re: IF condition not working

    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

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard