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 Platform Community / Forums / Power Apps / The Function If has so...
Power Apps
Answered

The Function If has some invalid arguments

(0) ShareShare
ReportReport
Posted on by 3,514

I have the following formula "If(IsBlank(Var1),Parent.Default,Var1)" inside my DefaultSelectedItems, but i am getting this error "The Function If has some invalid arguments":-

 

If statment.png

 

Any advice on this please?

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @johnjohn123 

    If your logic is to use the Parent.Default if var1 is blank then 

    Coalesce(var1,Parent.Default) would work. If you mean to use var1 if the Parent.Default is blank (such as would be the case if a form was in New mode, then

    Coalesce(Parent.Default,var1) would be the correct formula to use.  FYI, Coalesce() checks each element in sequence for one that is not blank then stops. 

     

  • AndreaMondello Profile Picture
    on at

    According to the documentation "To test specifically for a blank value use if(Value = Blank(),.. instead of IsBlank."   Blank, Coalesce, IsBlank, and IsEmpty functions - Power Apps | Microsoft Docs

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @johnjohn123 

    As @Drrickryp has mentioned, the Coalesce function should become your go-to function for these type of things.

    However, I don't believe that your issue is coming from the formula.  It is most likely an issue with var1.

    Since you are setting the DefaultSelectedItems property of that control, it MUST be a Table of Records compatible with the schema of the Items property of the combobox.

    So, how are you assigning to var1 ?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @RandyHayes 

    Thanks for coming to the rescue! I was playing around with it and found that that my approach didn't work.

  • johnjohn123 Profile Picture
    3,514 on at

    @Drrickrypwhich approach will not work?

     

    second question, if i use Coalesce(Parent.Default,var1)  then on new form both the values will be empty,, so will Coalesce chose the last value?

  • johnjohn123 Profile Picture
    3,514 on at

    @RandyHayesi am not assign the Var1, i am using it to set the value of the drop-down value when i click on a button, as follow:-

     

    Set(Var1,Filter(Choices([@'Approval Process'].'Document Approval Process Status'),Value="Submitted"));SubmitForm(SharePointForm1)

     

    i hope this explain the case for you...

  • johnjohn123 Profile Picture
    3,514 on at

    @AndreaMondelloit is surprising that most of the formulas which i got on this forum do not work...

  • johnjohn123 Profile Picture
    3,514 on at

    @AndreaMondelloi also tried your formual

     

    If(Parent.Default=Blank(),Today(),Parent.Default)

     

    and it will not work... i will always get today() date !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @johnjohn123 

    I am not sure why you are referring to the Date now...what does this have to do with your question on setting your combobox?

     

    What I am not getting is what you are trying to do.  

    You provided the following formula:

    Set(Var1,Filter(Choices([@'Approval Process'].'Document Approval Process Status'), Value="Submitted")); SubmitForm(SharePointForm1)

     

    So why are you setting a variable and then submitting a form?  That makes no sense in the context of the DefaultSelectedItems property that you are trying to set.  

     

    Can you elaborate more on where you are trying to go on this problem?

  • johnjohn123 Profile Picture
    3,514 on at

    @RandyHayesnow i have a drop-down list titled "document approval process status".. and it is disabled.. and i have a button name "Submit for approval" when clicked will set the drop-down value to be "submitted" using this formula:-

     

    Set(Var1,Filter(Choices([@'Approval Process'].'Document Approval Process Status'), Value="Submitted")); SubmitForm(SharePointForm1)

     

     

    and i set the default value for the drop-down to be equal to Var1. things will work well >> where if i click on the button the value of the drop-down will be set to Submitted + the form will get saved (submitted).. but the issue is; if i edit the form and the item already has a value inside the drop-down list then the drop-down list will be empty.. so i tried this forumal to get the current value of the drop-down list, but i got the error:-

     

    If statment.png

     

     

     

    i hope this explain the case..

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 531 Most Valuable Professional

#2
Haque Profile Picture

Haque 261

#3
Kalathiya Profile Picture

Kalathiya 221 Super User 2026 Season 1

Last 30 days Overall leaderboard