cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tobias
Regular Visitor

Problems with Date/Time and UpdateContext

Hey,

 

i have an app in which i can write the Date/Time in a Date/Time field by clicking on a button.

Behind the button is the following code:

 

UpdateContext({Total8:(Text( Now(); "[$-de-DE]dd/mm/yyyy hh:mm:ss" ))})

 

After clicking on the button i save the record with another button and this code:

 

SubmitForm(EditForm1)

 

By creating a new record i have another button which should empty the Date/Time field. Behind this button is the following code:

 

UpdateContext({Total8:""})

 

The problem is, that the saved record is "deleted" respectivly "cleared".

This must not happen.

Do you have any ideas how i can solve the problem?

Is there another possibility by cicking on a button to write the Date/Time in the Date/Time field not using the UpdateContext value?

 

Thanks for your help.

6 REPLIES 6
Meneghino
Community Champion
Community Champion

Hi @Tobias

The code UpdateContext({Total8:""}) by itself should not be deleting any records in any data source.

Are you sure that the record is being saved in the first place?

Hey @Meneghino

 

i think so.

In my opinion the code

 

SubmitForm(EditForm1)

 

should save the records i have written before.

If i want to edit the saved record there is no value in the Date/Time field.

 

Or is it possible that SubmitForm(EditForm1) does not save my records?

Meneghino
Community Champion
Community Champion

Hi @Tobias

The SubmitForm command should save, but have you checked if it does?

In any case UpdateContext should never save/edit/delete records in a data source.

Hey @Meneghino,

 

Okay i checked it and the date/time is saved.

Additionaly i can't overwrite the date, this is good.

But i have another problem with the ContextUpdate code i can "clear" the values.

If i want to edit the first record after i created a new record, the Date/Time fields of the old record contain the values of the new record.

This must not happen.

Additionaly i have to say that i do not have only one Date/Time field, i have 45 Date/Time fields.

It is difficult to explain what it should look like.

Hope you understand?

 

Meneghino
Community Champion
Community Champion

Hi @Tobias

Difficult to say why you have issues between old and new records without looking at the app.

Also, it sounds as though you have generic design issues, as there seems to no reason why any table would ever need 45 date/time fields.

If this is really important and you are stuck, we could get on a Skype call later this afternoon CET.

Hey @Meneghino

 

Sorry on friday i am only working until 12:15 pm.

No no, i really need the 45 date/time fields.

We want to take up the set-up time in our company and after every step our fitters make there must be the option to write a time for starting an interruption and ending this interruption.

 

Maybe you can help me via chat?

I just hope you can unterstand me...my english is not the best.

 

Thx a lot.

 

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (16,875)