Set Time question

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Set Time question

4D Tech mailing list
Hi List,
I have never used Set timer very much so I've got a noobie question. I'm
adding some real-time updating code to financial forms: think Invoices,
Billing Account summaries. that sort of thing. An invoice is the most
obvious - User A has a form open that displays the invoice details (total
amount, balance due). I want to update the balance due when a new payment
is applied which could be from anywhere in the system. I have the code for
all that worked out the issue is managing displaying the balance due part.

Set timer is one solution. Every couple of seconds the form can simply
reload the invoice details. The issue is the interruption to the user if
they are doing something else on the form. Like entering data in a field or
variable. Is there a way to trap use actions like that so I can block the
On timer code from running?

--
Kirk Brooks
San Francisco, CA
=======================

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

RE: Set Time question

4D Tech mailing list
Kirk,

You can create an independent process that is hidden to user which simply wakes up, does the calculation, and then calls the process.  It you use IP variables you can have them auto-update based on the call to the process.  We do this for projects that require this type of updating....no real interruption to the user.

Just one thought..


Steve

*********************************************
  Stephen J. Orth                                                
  The Aquila Group, Inc.          Office:  (608) 834-9213
  P.O. Box 690                           Mobile:  (608) 347-6447
  Sun Prairie, WI 53590

  E-Mail:  [hidden email]
*********************************************

-----Original Message-----
From: 4D_Tech <[hidden email]> On Behalf Of Kirk Brooks via 4D_Tech
Sent: Friday, February 8, 2019 10:48 AM
To: 4D iNug Technical <[hidden email]>
Cc: Kirk Brooks <[hidden email]>
Subject: Set Time question

Hi List,
I have never used Set timer very much so I've got a noobie question. I'm adding some real-time updating code to financial forms: think Invoices, Billing Account summaries. that sort of thing. An invoice is the most obvious - User A has a form open that displays the invoice details (total amount, balance due). I want to update the balance due when a new payment is applied which could be from anywhere in the system. I have the code for all that worked out the issue is managing displaying the balance due part.

Set timer is one solution. Every couple of seconds the form can simply reload the invoice details. The issue is the interruption to the user if they are doing something else on the form. Like entering data in a field or variable. Is there a way to trap use actions like that so I can block the On timer code from running?

--
Kirk Brooks
San Francisco, CA
=======================

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Set Time question

4D Tech mailing list
In reply to this post by 4D Tech mailing list

> Le 8 févr. 2019 à 17:48, Kirk Brooks via 4D_Tech <[hidden email]> a écrit :
>
> [...] Is there a way to trap use actions like that so I can block the
> On timer code from running?

Each new SET TIMER "kills" the previously set one, so it allows to postpone or cancel next 'On timer'. For example when the user types into a search box, send the query after he has stopped input since one or 2 seconds.

Maybe something like this in form method could work:

jobPostponed:=60*2  //2 seconds, for example
case of
  on keystroke
    set timer(jobPostponed)
  on timer
    set timer(0)
    job.do(please)
    set timer(jobPostponed)
end case

Thinking after, there is surely more events to consider (On click, double clic, menu, etc.)

--
Arnaud de Montard


**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Set Time question

4D Tech mailing list
Hi Arnaud,
Aha. That hadn't even occurred to me. I think that's exactly what I was
looking for. Off the top of my head I think using the On Before Data Entry
for listboxes and On before keystroke for fields.

Thank you!

On Fri, Feb 8, 2019 at 10:18 AM Arnaud de Montard via 4D_Tech <
[hidden email]> wrote:

>
> > Le 8 févr. 2019 à 17:48, Kirk Brooks via 4D_Tech <[hidden email]>
> a écrit :
> >
> > [...] Is there a way to trap use actions like that so I can block the
> > On timer code from running?
>
> Each new SET TIMER "kills" the previously set one, so it allows to
> postpone or cancel next 'On timer'. For example when the user types into a
> search box, send the query after he has stopped input since one or 2
> seconds.
>
> Maybe something like this in form method could work:
>
> jobPostponed:=60*2  //2 seconds, for example
> case of
>   on keystroke
>     set timer(jobPostponed)
>   on timer
>     set timer(0)
>     job.do(please)
>     set timer(jobPostponed)
> end case
>
> Thinking after, there is surely more events to consider (On click, double
> clic, menu, etc.)
>
> --
> Arnaud de Montard
>
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[hidden email]
> **********************************************************************



--
Kirk Brooks
San Francisco, CA
=======================

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Set Time question

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Just to add a little more to this. I suspect a number of readers already
realized a really simple solution to this specific case is to simply test
the read/write state in the On timer form event and NOT update if it's read
write.

This turns out to be a better solution in my case because it's a single
place to test it vs. multiple points in the code otherwise. Easier to read
and understand.
However, it's also totally effective to just change toggle the Set timer
event on and off as Arnaud suggested, and in a different case could be
better.

Once more this turned out to be more of a question of how to look at the
problem.

On Fri, Feb 8, 2019 at 8:48 AM Kirk Brooks <[hidden email]> wrote:

> Hi List,
> I have never used Set timer very much so I've got a noobie question. I'm
> adding some real-time updating code to financial forms: think Invoices,
> Billing Account summaries. that sort of thing. An invoice is the most
> obvious - User A has a form open that displays the invoice details (total
> amount, balance due). I want to update the balance due when a new payment
> is applied which could be from anywhere in the system. I have the code for
> all that worked out the issue is managing displaying the balance due part.
>
> Set timer is one solution. Every couple of seconds the form can simply
> reload the invoice details. The issue is the interruption to the user if
> they are doing something else on the form. Like entering data in a field or
> variable. Is there a way to trap use actions like that so I can block the
> On timer code from running?
>
> --
> Kirk Brooks
> San Francisco, CA
> =======================
>
> What can be said, can be said clearly,
> and what you can’t say, you should shut up about
>
> *Wittgenstein and the Computer *
>
>

--
Kirk Brooks
San Francisco, CA
=======================

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Set Time question

4D Tech mailing list

> Le 10 févr. 2019 à 18:41, Kirk Brooks via 4D_Tech <[hidden email]> a écrit :
>
> Just to add a little more to this.

Me too, forgot to mention CALL FORM: has a message queue, can receive parameters, can call its own window, allows to execute almost any method in the context of the form… In a recent 4d training, someone told me he had replaced a lot of "On timer" old code with it.

--
Arnaud de Montard




**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Set Time question

4D Tech mailing list
On 14 Feb 2019, at 10:18 pm, Arnaud de Montard via 4D_Tech <[hidden email]> wrote:
>
>
>> Le 10 févr. 2019 à 18:41, Kirk Brooks via 4D_Tech <[hidden email]> a écrit :
>>
>> Just to add a little more to this.
>
> Me too, forgot to mention CALL FORM: has a message queue, can receive parameters, can call its own window, allows to execute almost any method in the context of the form… In a recent 4d training, someone told me he had replaced a lot of "On timer" old code with it.


True, but sometimes you may need to still use On Timer since CALL FORM doesn't always execute in a new cycle, i.e. if you make a change which needs the form to be redrawn before the things you want to do with CALL FORM run, you still need to use On Timer (or POST OUTSIDE CALL) instead as it is possible the CALL FORM will execute in the current cycle.

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************