cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JasonCastro
Helper I
Helper I

Update a Date coluum using Patch fuction

I need to change the DateColuum only when a certain option is selected.

In the code below I get the value of the combobox in a variable and then I try to insert it in the ID of that data

When I put the" varBoxAtm" variable in the Patch function, it is understood as a "Record" type and not as a Date".

 

If(comboBoxAtm.Selected.Value = "Foo";
Set(varBoxAtm; Now()));;

Patch(
    TBL_INFO;
    {
       DateColuum:   {
                        ID: emergencyGallery.Selected.ID;
                        Value: varBoxAtm;
              }        
        
    }
);;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@JasonCastro 

Yes...you are setting the entire column to a record.  Your syntax is not correct.

Please consider changing your Formula to the following:

If(comboBoxAtm.Selected.Value = "Foo";
    Patch(TBL_INFO;
       {
       ID: emergencyGallery.Selected.ID;
       DateColuum:  Now()        
       }
    )
);;

You don't need the variable to do this.  I took it out.  If you happen to need it elsewhere, just add it back.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
RandyHayes
Super User
Super User

@JasonCastro 

Yes...you are setting the entire column to a record.  Your syntax is not correct.

Please consider changing your Formula to the following:

If(comboBoxAtm.Selected.Value = "Foo";
    Patch(TBL_INFO;
       {
       ID: emergencyGallery.Selected.ID;
       DateColuum:  Now()        
       }
    )
);;

You don't need the variable to do this.  I took it out.  If you happen to need it elsewhere, just add it back.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

It's even better without using the IF, thanks!

RandyHayes
Super User
Super User

@JasonCastro 

Excellent!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,039)