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 Apps
Answered

Help please

(0) ShareShare
ReportReport
Posted on by 91
Hi,
 
Can someone please tell me why I have an error here:
 
If(
   fx_conn,

   IfError(
      RemoveIf(col_venues, col_ID=var_ID);,

      Set(var_msg, 11);
   ),

   Set(var_msg, 10);
);

If error and the semicolon after 11) are underlined in red. “The function ‘IfError’ has some invalid arguments”
I’ve stripped out most of the code to simplify it. 
 
If I replace the RemoveIf with blank() - there is no error.
 
RemoveIf on it’s own - there is no error
 
I’ve used this flow all over my app and it hasn’t thrown any errors. It’s the first time I’m using RemoveIf and it won’t accept it.
 
 
Categories:
  • Suggested answer
    mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at
    hey
     
     
     
    can u please try this:
    If(
       fx_conn,
       IfError(
          RemoveIf(col_venues, col_ID = var_ID),
          Set(var_msg, 11)
       ),
       Set(var_msg, 10)
    );
    
    if it helped please mark as verified answer
     
     
    cheers
  • Samand Profile Picture
    91 on at
     
    I’ve removed the semicolons and this time Set(var_msg, 11) is highlighted (as well as IfError) . “Invalid argument type (Boolean). Expecting a Table value instead.”

    But I can’t just remove the semicolons. I’ve stripped out most of the code and I need the semicolons to run subsequent actions.
  • mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at
    hey
     
     
    can u try this modification:
    If(
       fx_conn,
       If(
          RemoveIf(col_venues, col_ID = var_ID),
          true, 
          Set(var_msg, 11)
       ),
       Set(var_msg, 10)
    );
    
    please mark as verified if it helped
     
     
    cheers
  • Samand Profile Picture
    91 on at
     
    Same issue as the latest time.
     
    Here’s the funny bit. I’ve moved a bit of code, because I noticed it was in the wrong sequence. No errors. But when I want to switch (remove) parts off for testing, so I can test the remaining bits. I get the error. And I can’t figure out why the syntax would be wrong.
  • Samand Profile Picture
    91 on at
    Here’s the original syntax for reference:
    Set(bl_runCode, true);
    Set(gv_Now, Now());
    If(
        fx_conn,
     
        IfError(
            Set(var_msg, 2);
     
            RemoveIf(col_PDDC_FMFT_VENUES, FMFT_ID=gv_FMFT_ID And REF_BUILDING_ID=var_ID);
            RemoveIf(PDDC_FMFT_VENUES, FMFT_ID=gv_FMFT_ID And REF_BUILDING_ID=var_ID);
     
            If(
                gv_int_01>0,
     
                Set(gv_int_01, CountRows(fx_FMFT_Venues));
                Set(gv_int_02, CountRows(Distinct(Filter(col_MPD_PROPERTY, REF_ID in fx_FMFT_Venues.REF_ID), FM_REGION)));
                   
                If(
                    gv_int_01=1,
     
                    Patch(col_PDDC_FMFT, LookUp(col_PDDC_FMFT, FMFT_ID=gv_FMFT_ID), {FMFT_ID: fx_FMFT_Ref_ID, REF_BUILDING_ID: First(fx_FMFT_Venues).REF_BUILDING_ID, TNAME: First(fx_FMFT_Venues).TNAME, ADDRESS: fx_ADDRESS(First(fx_FMFT_Venues).REF_ID), SCOPE: "Single Building"});
                    Patch(PDDC_FMFT, LookUp(PDDC_FMFT, FMFT_ID=gv_FMFT_ID), {FMFT_ID: fx_FMFT_Ref_ID, REF_ID: First(fx_FMFT_Venues).REF_ID, TNAME: First(fx_FMFT_Venues).TNAME, ADDRESS: fx_ADDRESS(First(fx_FMFT_Venues).REF_ID), SCOPE: "Single Building"});
     
                    RemoveIf(col_PDDC_FMFT_VENUES, FMFT_ID=gv_FMFT_ID);
                    RemoveIf(PDDC_FMFT_VENUES, FMFT_ID=gv_FMFT_ID);,
     
                    If(
                        fx_FMFT_Scope <> First(Filter(col_PDDC_FMFT, FMFT_ID=gv_FMFT_ID)).SCOPE,
     
                        Set(gv_tbl, fx_FMFT_Venues.REF_ID);
                        Patch(col_PDDC_FMFT, LookUp(col_PDDC_FMFT, FMFT_ID = gv_FMFT_ID), {REF_ID: CountRows(fx_FMFT_Venues) & " Buildings", SCOPE: "Regional", TNAME: If(gv_int_02 = 1, Proper(fx_FMFT_Region) & " Region", "National")});
     
                        Patch(PDDC_FMFT, LookUp(PDDC_FMFT, FMFT_ID = gv_FMFT_ID), {REF_ID: CountRows(fx_FMFT_Venues) & " Buildings", SCOPE: "Regional", TNAME: If(gv_int_02 = 1, Proper(fx_FMFT_Region) & " Region", "National")});,
     
                        Patch(col_PDDC_FMFT, LookUp(col_PDDC_FMFT, FMFT_ID=gv_FMFT_ID), {REF_ID: CountRows(fx_FMFT_Venues)&" Buildings"});
                        Patch(PDDC_FMFT, LookUp(PDDC_FMFT, FMFT_ID=gv_FMFT_ID), {REF_ID: CountRows(fx_FMFT_Venues)&" Buildings"});
                    );
                );
            );
     
            If(
                IsBlank(First(Filter(PDDC_FMFT_VENUES, FMFT_ID=gv_FMFT_ID And REF_ID=gal_fmft_main_02.Selected.REF_ID)).FMFT_ID),
                Set(var_msg, 0);,
                Set(var_msg, 11);
            );,
     
            Set(var_msg, 11);
        );,
        Set(var_msg, 10);
    );
    Set(bl_runCode, false);
    UpdateContext({bl_04: false});
     
  • ronaldwalcott Profile Picture
    3,914 Moderator on at
    Not exactly sure what you are trying to accomplish but as far as I know IfError is used to replace an error with a valid replacement value.
    Showing parameter use
     
    e.g IfError(This results in a record, This results in a record) - this a valid use
     
    IfError(This results in a table, This results in a boolean) - invalid use 
     
    In your full code why are you using IfError? What error do you need to check for which would result in the code failing?
  • Samand Profile Picture
    91 on at
     
    Ok, I might be using the IfError incorrectly then. What I’m trying to do is to check if my code* runs without any problem. If there is a problem, I need var_msg to equal 11.
     
    *patches to SharePoint
     
    If IfError can’t catch errors, what can?
  • Suggested answer
    ronaldwalcott Profile Picture
    3,914 Moderator on at
    You need to use the Errors function every time you use Patch to verify if it succeeded or failed. 
    The documentation at Errors function - Power Platform | Microsoft Learn gives you a list o the errors that you can check for.
     
     
  • Samand Profile Picture
    91 on at
     
    How does that’s compare to IsError?
  • Verified answer
    ronaldwalcott Profile Picture
    3,914 Moderator on at
    You have to refactor your code by first removing the IfError.
    After running Patch or RemoveIf, you can check for an error using the Errors function (this function returns a table).
    If you only need to check if an error was generated then you can use somethiing like
     
    IsEmpty( Errors( fx_conn ) )
     
    If this is true then no errors were generated so if you have your own set of error codes or messages you could use something like
     
    If (!IsEmpty( Errors( fx_conn ) ), Set(var_msg, 11))
     
    after your RemoveIf and Patch.
    This would report any error in the particular table but for the patch you can check for errors related to the record that you may be updating with a slight modification to the Errors statement. 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard