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

Timer not working

I have a custom SharePoint form with a button and a timer set to 3s with the following code in both.  The timer auto starts and does run for 3s.

steve_hendy_0-1641485085548.png

 

Set(
varlookupCourses,
LookUp(
'Work Activity Approvals',
ID = Value(DataCardValue8.Text),
Name
)
);
ClearCollect(
col_Courses,
LookUp(
'Courses Required for Work Activity',
varlookupCourses = Title
).'Courses Required'
);
Set(
varCourses,
col_Courses
)

 

If I press the button it works but when the timer finishes it doesn't work.  Why doesn't the timer code (OnTimerEnd) run?  I'm trying to do away with the button.

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@steve_hendy 

You don't need a timer to replace a button.  You simply need to put the formula in your control that you want.

If you are trying to get the value of a Lookup to a datasource in the label, then that is all you need in the Text property of the label.

 

Can you provide more detail on what the error was...not just that it was red underlined?  Knowing the error it is stating will explain what the problem is and will provide a clue for me as to what is going on.

 

However...making a guess by looking at your current formula in the label, and based on a statement I made previously in a response that it seemed you were trying to get a table of records...not a single lookup record.  You stated that you just wanted to display a variable that was created.  But in fact, you are using the Concat function on a variable...not just a variable.  

So, based on that, I am deducing that the 'Courses Required' column is a Lookup column in your datasource.

Also, I will be deducing that the error you are seeing when trying the formula is "expected text value" and not a record.

 

So, your formula in the Label then (based on all of those assumptions) is:

Concat(
   LookUp('Courses Required for Work Activity',
    Title =  LookUp('Work Activity Approvals', ID = IfError(Value(DataCardValue8.Text), 0), Name),
    'Courses Required'
   ),
   Value & ", "
)

 

Which...to reduce the trailing comma, can be changed to:

With({_v:
   Concat(
      LookUp('Courses Required for Work Activity',
       Title =  LookUp('Work Activity Approvals', ID = IfError(Value(DataCardValue8.Text), 0), Name),
       'Courses Required'
      ),
      Value & ", "
   )},
   Left(_v, Len(_v)-2)
)

The above will produce a formatted text value based on the Lookup to the lists you stated.

_____________________________________________________________________________________
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

6 REPLIES 6
RandyHayes
Super User
Super User

@steve_hendy 

What is it that you are trying to accomplish with the timer?

 

Your formula can be refined to:

Set(
    varCourses,
    LookUp('Courses Required for Work Activity',
        Title =  LookUp('Work Activity Approvals', ID = IfError(Value(DataCardValue8.Text), 0), Name),
        'Courses Required'
    )

 

It seems that you are trying to also get a list of courses.  However, the LookUp function is only going to return one result.  

_____________________________________________________________________________________
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!

The code works fine and returns 2 items in this case and without delegation.  Its a label, bottom row in my picture.  I want the label to display my variable when the form opens or if I make a change to another combobox.  As I said the button works but the timer doesn't and the same code is in both.  The form is the same form for new, edit and view.

RandyHayes
Super User
Super User

@steve_hendy 

Yes, so I am not sure of the purpose of the timer then.  If you want that value in the Label then you just need the formula on the Text property:

LookUp('Courses Required for Work Activity',
    Title =  LookUp('Work Activity Approvals', ID = IfError(Value(DataCardValue8.Text), 0), Name),
    'Courses Required'
)

What role does a timer play in your app?

_____________________________________________________________________________________
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!
steve_hendy
Resolver I
Resolver I

I have a formula in the label Concat(varCourses,Value,", ").  I tried pasting your formula there but it did not work, everything was red underlined.

 

For the second time, the purpose of the timer is to do away with the button.

RandyHayes
Super User
Super User

@steve_hendy 

You don't need a timer to replace a button.  You simply need to put the formula in your control that you want.

If you are trying to get the value of a Lookup to a datasource in the label, then that is all you need in the Text property of the label.

 

Can you provide more detail on what the error was...not just that it was red underlined?  Knowing the error it is stating will explain what the problem is and will provide a clue for me as to what is going on.

 

However...making a guess by looking at your current formula in the label, and based on a statement I made previously in a response that it seemed you were trying to get a table of records...not a single lookup record.  You stated that you just wanted to display a variable that was created.  But in fact, you are using the Concat function on a variable...not just a variable.  

So, based on that, I am deducing that the 'Courses Required' column is a Lookup column in your datasource.

Also, I will be deducing that the error you are seeing when trying the formula is "expected text value" and not a record.

 

So, your formula in the Label then (based on all of those assumptions) is:

Concat(
   LookUp('Courses Required for Work Activity',
    Title =  LookUp('Work Activity Approvals', ID = IfError(Value(DataCardValue8.Text), 0), Name),
    'Courses Required'
   ),
   Value & ", "
)

 

Which...to reduce the trailing comma, can be changed to:

With({_v:
   Concat(
      LookUp('Courses Required for Work Activity',
       Title =  LookUp('Work Activity Approvals', ID = IfError(Value(DataCardValue8.Text), 0), Name),
       'Courses Required'
      ),
      Value & ", "
   )},
   Left(_v, Len(_v)-2)
)

The above will produce a formatted text value based on the Lookup to the lists you stated.

_____________________________________________________________________________________
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!

Hi Randy Thanks for your help, This morning I used your technique and got it working. I ended up with this.

With(
{
_v: Concatenate(
Concat(
LookUp(
'Courses Required for Work Activity',
Dropdown1.Selected.Title = Title,
'Courses Required'
),
Value & ", "
),
Concat(
LookUp(
'Courses Required for Work Activity',
Dropdown1.Selected.Title = Title,
'Courses Required:Certificate'
),
Value & ", "
)
)
},
Left(
_v,
Len(_v) - 2
)
)

 

The final output looked like this 

steve_hendy_0-1641892322910.png

 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

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.

Users online (4,307)