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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,397)