Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

renatoteles
New Contributor

Reset Timer

Hello everyone,

I have a dashboard getting a table from a database. This table has a field to indicate the type of operation (Start,Point,Stop and Finish). 

I´ve configured an object text with the sentence below to work like a decreasing timer 

=interval(variable1-now())

The variable1 is set with the expression:

=timestamp(now()+(3/1440))

I need to reset the timer (update the variable1) always when the type of the last row is equal to Start or Point and stop the timer when the last row is equal to Stop or Finish.

Does anyone knows how can i do this?

 

5 Replies

Re: Reset Timer

Hi, I'm not sure to understand your question... maybe you can add the value while reloading data, using Peek().

If it's in design time you can use bottom() to reach the last record inside the table.

If it's outside the table you can use set analysis to emulate the table query for the last row and use the value returned.

Can you post a sample of what are you trying to do?
renatoteles
New Contributor

Re: Reset Timer

Hi Rubenmarin,

Follow below a screenshot of the panel:

Panel.png

There's no user's interaction with the panel and i'll set to reload continuously, so, when the last record has the type Start or Pointment , the timer will reset an start the countdown and where has the type Stop or Finish the timer will have the value 00:00:00 till start again.

 

 

 

Re: Reset Timer

don't know, maybe:
TableName:
LOAD * from table;

// store last row operation in a variable
LET vLastOperation = Peek('Operation', NoOfRows('TableName')-1,'TableName');

// Create expression based on last row operation
IF '$(vLastOperation)'='Start' or '$(vLastOperation)'='Pointment' THEN
SET Expression = =interval(variable1-now());
ELSE
SET Expression = =interval(0);
ENDIF
renatoteles
New Contributor

Re: Reset Timer

The expression LET vLastOperation = Peek('Operation', NoOfRows('TableName')-1,'TableName'); is returning null, what could it be?

Re: Reset Timer

Try adding Noofrows in a different variable to check:
LET vNumRows = NoOfRows('TableName');
LET vLastOperation = Peek('Operation', $(vNumRows )-1,'TableName');

And confirm table rows (in log or Document properties->tables) should be the same as vNumRows, also confirm that the last row has a value in OperationField.
'Operation' should be the field name
'TableName' should be the table name