cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rama96x
Resolver I
Resolver I

Patch OnTimerEnd

Hello,

 

I wannabe able to Patch some basic text into my Dataverse table, however, nothing really on the property OnTimerEnd

This is what I have done:

Set(
    varStartSampleNow,
    Patch(
        'Test Data',
        LookUp(
            'Test Data',
            varStartSampleNow.'Test Data' = 'Test Data'
        ),
        {Notification_2: "X"}
    )
);

 

1 ACCEPTED SOLUTION

Accepted Solutions

@WarrenBelz 
Yes it is unique! 🙂 
I managed to make it work.

The reason why it didn't work was because it didn't "understand" when the timer ends. The reason was that the 'main timer' acted as a stopper for the other timer, so it would only patch when the main timer actually ended... 

View solution in original post

6 REPLIES 6
WarrenBelz
Super User
Super User

Hi @Rama96x ,

What are you trying to do here - your criteria is when the field equals a value in the variable that is not set yet (it is the end result of the code)

LookUp(
   'Test Data',
    varStartSampleNow.'Test Data' = 'Test Data'
),

 

@WarrenBelz sorry, I should have explained this part
I have a "Start timer" button, where I am basically patching start time, user email and setting the Timer as active.
This is stored in a global variable called varStartSampleNow

 

What I'm then trying to do now is having a second timer that counts down with -30 minutes in relation to the main timer. When this timer has then ended I want to patch to this specific record which I'm targeting through an ID (called 'Test Data'). 

Basically, LookUp an existing record and patch to column name 'Notification_2'

 

Hope it makes sense!

Set(
    varStartSampleNow,
    Patch(
        'Test Data',
        Defaults('Test Data'),
        {
            'Taken By': User().Email,
            'Timer Active': true,
            'Timer Start':Today() + Time(Value(txtDDHour.Text),Value(txtDDMinute.Text),0)
        }
    )
)

Hi @Rama96x ,

Still a bit lost - your initial post Lookup has it looking at itself, so all records will equal.

I tried to add this bit of code on a button on its OnSelect property, and this works as intended (it patches to a specific ID), so I don't agree that it equals all records

 

Patch(
    'Test Data',
    LookUp(
        'Test Datas',
        varStartSampleNow.'Test Data' = 'Test Data'
    ),
    {Notification_1: "TEST"}
);

 

 

I also tested this on a different timer where I'm basically just patching a new record (Defaults), and this works fine on the OnTimerEnd property on a timer. I think the issue is that the timer that is supposed to act as a notification is counting down and not up, so perhaps it doesn't understand when the timer actually ends?

@Rama96x ,

I do not use Table Variables (that is what collections are for), but I see it now if 'Test Data' is unique. So you are saying this does not change the required record ? 

@WarrenBelz 
Yes it is unique! 🙂 
I managed to make it work.

The reason why it didn't work was because it didn't "understand" when the timer ends. The reason was that the 'main timer' acted as a stopper for the other timer, so it would only patch when the main timer actually ended... 

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (4,699)