Recent

Author Topic: Automatic refresh when inserting from another workstation?  (Read 2182 times)

Merzh

  • Newbie
  • Posts: 2
Automatic refresh when inserting from another workstation?
« on: February 06, 2019, 12:46:37 pm »
Hello,

I'm going to build an app that will be used by many-computers.
This app will works with a firebird database server.
how can I refresh my Datas only if a new record is added on the database ?

For example :  Imagine that we have 2 transactions in the app
The first is a form with many fields and a save button.
The second is a reporting form which show us in a grid all the records added by the first form.

For my reporting form i would want refresh my datas grids only if a new record is added on the database.

I could basically setting up a timer to refresh my grid every "x" seconds but i'm sure  that we can find a better way

I had looked the component TFBEventMonitor. I'm not sure that I understood very well this component, I guess that this component works with Triggers events from database, but i'm not sure.

Can you tell me if I am on the good way?

thanks helping me

sash

  • Sr. Member
  • ****
  • Posts: 366
Re: Automatic refresh when inserting from another workstation?
« Reply #1 on: February 06, 2019, 01:00:24 pm »
Yes, you can use TFBEventMonitor and Firebird's post_event for your purpose.
http://wiki.freepascal.org/TFBEventMonitor

For the SQL part, please read Firebird documentation covering these keywords: trigger, stored procedure and post_event.
Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE

rvk

  • Hero Member
  • *****
  • Posts: 6110
Re: Automatic refresh when inserting from another workstation?
« Reply #2 on: February 06, 2019, 01:01:44 pm »
Can you tell me if I am on the good way?
Yes, if you really, really don't want to refresh manually, events from a trigger are the way to go.

But are you sure refreshing is really a bad thing?

Even if you work with events, the 'view' of the screen still needs to be refreshed when that event occurs (resulting in a flicker of even a shift in position). Doing this on a idle timer, or even when the user presses F5 for refresh, might be sufficient in most cases.

syrecky

  • New Member
  • *
  • Posts: 11
Re: Automatic refresh when inserting from another workstation?
« Reply #3 on: February 10, 2019, 10:32:43 am »
I use FireBird and EVENTS.
Automatic refresh is often inappropriate in a real situation.
I solve this with the indication (blinking button, etc.), that it is advisable to make a handmade refresh.

Merzh

  • Newbie
  • Posts: 2
Re: Automatic refresh when inserting from another workstation?
« Reply #4 on: February 13, 2019, 01:52:17 pm »
 it works. Thank you for your help  :D

 

TinyPortal © 2005-2018