cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jose1 Advocate II
Advocate II

Cannot Patch Float or Number

Hello everyone,

 

I'm having trouble patching a integer or float value into a SQL table. The field in question is in red and underlined in the following formula:

 

UpdateContext({DisableVar:true}); Patch('[dbo].[volunteer_sign_in]', Defaults('[dbo].[volunteer_sign_in]'), {volunteer_id: ActiveVolunteers.Selected.volunteer_id, last_name: ActiveVolunteers.Selected.last_name, first_name: ActiveVolunteers.Selected.first_name, initials: ActiveVolunteers.Selected.initials, date: SignInDate.SelectedDate, hours: SignInHours}); UpdateContext({ResetVar: true}); UpdateContext({ResetVar:false}); UpdateContext({DisableVar:false}); Navigate(StartScreen, ScreenTransition.None)

 

When I remove this field from the Patch function, a record is created; however, when I include the Hours field, I receive an unknown error message. I've changed the data type on the table from float to integer, and the control only accepts number values. I'm unsure where the issue lies. Any help is appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: Cannot Patch Float or Number

I think the problem might be that SignInHours are treated as a sting while the database requires a number value. 

Try wrapping it in Value() it changes string into an number value

 

So your function would be something like this:

UpdateContext({DisableVar:true});
Patch(
  '[dbo].[volunteer_sign_in]', 
  Defaults('[dbo].[volunteer_sign_in]'),
  {
    volunteer_id: ActiveVolunteers.Selected.volunteer_id,
    last_name: ActiveVolunteers.Selected.last_name,
    first_name: ActiveVolunteers.Selected.first_name, 
    initials: ActiveVolunteers.Selected.initials, 
    date: SignInDate.SelectedDate, 
    hours: Value(SignInHours)
  }
); 
UpdateContext({ResetVar: true}); 
UpdateContext({ResetVar:false}); 
UpdateContext({DisableVar:false}); 
Navigate(StartScreen, ScreenTransition.None)

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Re: Cannot Patch Float or Number

I think the problem might be that SignInHours are treated as a sting while the database requires a number value. 

Try wrapping it in Value() it changes string into an number value

 

So your function would be something like this:

UpdateContext({DisableVar:true});
Patch(
  '[dbo].[volunteer_sign_in]', 
  Defaults('[dbo].[volunteer_sign_in]'),
  {
    volunteer_id: ActiveVolunteers.Selected.volunteer_id,
    last_name: ActiveVolunteers.Selected.last_name,
    first_name: ActiveVolunteers.Selected.first_name, 
    initials: ActiveVolunteers.Selected.initials, 
    date: SignInDate.SelectedDate, 
    hours: Value(SignInHours)
  }
); 
UpdateContext({ResetVar: true}); 
UpdateContext({ResetVar:false}); 
UpdateContext({DisableVar:false}); 
Navigate(StartScreen, ScreenTransition.None)

View solution in original post

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (7,757)