Skip to main content

Notifications

Community site session details

Community site session details

Session Id : Z0MZeDYJvZJwMbYZS8sk2x
Power Apps - Building Power Apps
Answered

Patch based on an If()

Like (0) ShareShare
ReportReport
Posted on 28 Feb 2023 10:17:50 by 25

HI all,

 

I am hoping for some help as I can't figure out where I have gone wrong with this one:

 

Creating a Name Change option on a powerapp and if the change is back dated I need an error message to show, but if today or future dated change then it needs to patch a tracker for changes to be submitted to a central team, then make the name change overlay not visible. 

 

If(    IC_NC_Dat.SelectedDate>=Today(),       
           
Patch ('Requested Changes Trackers',
                Defaults('Requested Changes Trackers'),
                {'Effective Date':IC_Eff_Dat_Pick.SelectedDate},
                {'Employee Number': varIndEmp},
                {Name: IC_NN_Home.Text},
{'Change Type': Text("Name Change")
                ) &&
                Reset(IC_Eff_Dat_Pick) && Reset(IC_NN_Home) && Set(varShowNamChan,false),


                Set (varErrMess, true));

 

I am new to powerapps still so any help is appreciated.

 

Many thanks
Cat

Categories:
  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on 28 Feb 2023 at 11:39:45
    Re: Patch based on an If()

    @KitCat

    If(IC_NC_Dat.SelectedDate<Today(),

    Notify("Date must be today or later", Error),
    Patch ('Requested Changes Trackers',
    Defaults('Requested Changes Trackers'),
    {'Effective Date':IC_NC_Dat.SelectedDate},
    {'Employee Number': varIndEmp},
    {Name: IC_NN_Home.Text},
    {'Change Type': Text("Name Change")
    } );
    Reset(IC_NC_Dat);

    Reset(IC_NN_Home);

    Set(varShowNamChan,false);

    Set (varErrMess, true)

    )

  • KitCat Profile Picture
    25 on 28 Feb 2023 at 11:26:40
    Re: Patch based on an If()

    Hi Thanks for this - I need the reset and to make the screen not visible only if the error is not shown.

     

    Can we do that please?

  • Akser Profile Picture
    1,546 Super User 2025 Season 1 on 28 Feb 2023 at 11:13:40
    Re: Patch based on an If()

    Hi @KitCat,

     

     

    If(
     IC_NC_Dat.SelectedDate>=Today(), 
     Patch(
     'Requested Changes Trackers',
     Defaults('Requested Changes Trackers'),
     {
     'Effective Date':IC_NC_Dat.SelectedDate,
     'Employee Number': varIndEmp,
     Name: IC_NN_Home.Text,
     'Change Type': "Name Change"
     }
     ),
     Set (varErrMess, true)
    );
    Reset(IC_NC_Dat);
    Reset(IC_NN_Home); 
    Set(varShowNamChan,false)

     

  • KitCat Profile Picture
    25 on 28 Feb 2023 at 10:25:49
    Re: Patch based on an If()

    As an update I have amended some errors I have found but it has not stopped throwing the errors. Please see below for amended code:

     

    If(    IC_NC_Dat.SelectedDate>=Today(),       
               
    Patch ('Requested Changes Trackers',
                    Defaults('Requested Changes Trackers'),
                    {'Effective Date':IC_NC_Dat.SelectedDate},
                    {'Employee Number': varIndEmp},
                    {Name: IC_NN_Home.Text},
    {'Change Type': Text("Name Change")
                    ) &&
                    Reset(IC_NC_Dat) && Reset(IC_NN_Home) && Set(varShowNamChan,false),


                    Set (varErrMess, true));

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,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started