Open 4GL form when record inserted...
Posted in 1999
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL, Triggers, Constraints & Referential Integrity
In article <381EDA52.DBCC3CDC@querix.com>,
Mehdi <mehdi@querix.com> wrote:
>
>
> mojo_risin@my-deja.com wrote:
>
> > Is the term "alert" (as used below) a 4GL function or
feature?
Or,
is
> > it just your generic description for a type of record to
search
for?
> > --
> > In article <381DBB09.DBD47DE1@querix.com>,
> > Mehdi <mehdi@querix.com> wrote:
> > > A good way would be to have a process which is
continuously
polling
> > the
> > > database for an alert record,
> >
> > Would a trigger be a good way to implement this?
>
> Not really, you might be able to get the trigger to fire off an
> application, but it would run on the Unix server which isn't
what you
> want.
Actually, I was thinking about having the X-Windows Motif
4GL version run (I am UNIX application literate, not Microsoft)
and "pop" open a window on an X-server running on a
PC/XTerm/NC.
> Consider the following table (this is just bear bones):
>
> CREATE TABLE my_alerts(alert_no serial,
> alert_text char(80));
Where would you run the code below? I'm very rusty with
Informix's 4GL and have not worked with triggers or stored
procedures.
The way I understand what triggers do is that per some
action, a trigger
will perform some action or function. I would like this action to
open
up a new window (in an X-window environment) with the newly
inserted record in the 4GL form.
> MAIN
> DEFINE cur_nr,new_nr LIKE my_alerts.alert_no
> DEFINE runstr CHAR(256)
>
> SELECT MAX(alert_no) INTO cur_nr FROM my_alerts
>
> DECLARE alert_crs AS SELECT alert_no FROM
my_alerts WHERE
> alert_no > cur_nr
>
> WHILE TRUE
> FOREACH alert_crs INTO new_nr
> LET runstr = 'alertprog ',new_nr
> RUN runstr WITHOUT WAITING
> LET cur_nr = new_nr
> END FOREACH
> SLEEP 5
> END WHILE
> END MAIN
>
> This will run one instance of "alertprog" for each record in
my_alerts, if
> you only every want one instance of program alertprog, the
problem
becomes
> a little more difficult. You can either make the system only
spawn a
> single alert viewer each time round the loop, which would
cut down on
> spamming a bit, or, if you are expecting a lot of alerts:
>
> 1) Create a database table with a single row which
indacates whether
> the viewer is running.
> This has disadvantages if the viewer program is terminated
> abnormally.
>
> or 2) You will require some 'c' code to try to determine if the
> viewer program is running
My ideal method would be as follows, please comment:
1. New record is inserted into alert table which opens a 4GL
form to display in a window WITH the new record in it.
Questions
a. Is the method described by Mehdi a better way, or is a
trigger the better way since I will be running this from the
UNIX
server
b. Is it possible to start up a 4GL form with a specified
record in it when the form is displayed? And, what's the
function or syntax to do this?
2. 4GL form is run and displayed as a native X application, or,
as a character based application in an xterm window (ie xterm
-fn 9x15 -fb 9x15b -e <4GL_form_app>
3. User closes 4GL form when finished
Thanks.
MoJo Risin
--
<snip>
Sent via Deja.com http://www.deja.com/
Before you buy.
Ooops! Apologies for the re-post. . . . see previous message.
MoJo Risin
--
In article <7vuv94$rab$1@nnrp1.deja.com>,
mojo_risin@my-deja.com wrote:
> In article <381EDA52.DBCC3CDC@querix.com>,
> Mehdi <mehdi@querix.com> wrote:
> >
> >
> > mojo_risin@my-deja.com wrote:
> >
> > > Is the term "alert" (as used below) a 4GL function or
> feature?
> Or,
> is
> > > it just your generic description for a type of record to
> search
> for?
> > > --
> > > In article <381DBB09.DBD47DE1@querix.com>,
> > > Mehdi <mehdi@querix.com> wrote:
> > > > A good way would be to have a process which is
> continuously
> polling
> > > the
> > > > database for an alert record,
> > >
> > > Would a trigger be a good way to implement this?
> >
> > Not really, you might be able to get the trigger to fire off an
> > application, but it would run on the Unix server which isn't
> what you
> > want.
>
> Actually, I was thinking about having the X-Windows Motif
> 4GL version run (I am UNIX application literate, not Microsoft)
> and "pop" open a window on an X-server running on a
> PC/XTerm/NC.
>
> > Consider the following table (this is just bear bones):
> >
> > CREATE TABLE my_alerts(alert_no serial,
> > alert_text char(80));>
> Where would you run the code below? I'm very rusty with
> Informix's 4GL and have not worked with triggers or stored
> procedures.
>
> The way I understand what triggers do is that per some
> action, a trigger
> will perform some action or function. I would like this action to
> open
> up a new window (in an X-window environment) with the newly
> inserted record in the 4GL form.
>
> > MAIN
> > DEFINE cur_nr,new_nr LIKE my_alerts.alert_no
> > DEFINE runstr CHAR(256)
> >
> > SELECT MAX(alert_no) INTO cur_nr FROM my_alerts
> >
> > DECLARE alert_crs AS SELECT alert_no FROM
> my_alerts WHERE
> > alert_no > cur_nr
> >
> > WHILE TRUE
> > FOREACH alert_crs INTO new_nr
> > LET runstr = 'alertprog ',new_nr
> > RUN runstr WITHOUT WAITING
> > LET cur_nr = new_nr
> > END FOREACH
> > SLEEP 5
> > END WHILE
> > END MAIN
> >
> > This will run one instance of "alertprog" for each record in
> my_alerts, if
> > you only every want one instance of program alertprog, the
> problem
> becomes
> > a little more difficult. You can either make the system only
> spawn a
> > single alert viewer each time round the loop, which would
> cut down on
> > spamming a bit, or, if you are expecting a lot of alerts:
> >
> > 1) Create a database table with a single row which
> indacates whether
> > the viewer is running.
> > This has disadvantages if the viewer program is terminated
> > abnormally.
> >
> > or 2) You will require some 'c' code to try to determine if the
> > viewer program is running
>
> My ideal method would be as follows, please comment:
>
> 1. New record is inserted into alert table which opens a 4GL
> form to display in a window WITH the new record in it.
> Questions
> a. Is the method described by Mehdi a better way, or is a
> trigger the better way since I will be running this from the
> UNIX
> server
> b. Is it possible to start up a 4GL form with a specified
> record in it when the form is displayed? And, what's the
> function or syntax to do this?
>
> 2. 4GL form is run and displayed as a native X application, or,
> as a character based application in an xterm window (ie xterm
> -fn 9x15 -fb 9x15b -e <4GL_form_app>
>
> 3. User closes 4GL form when finished
>
> Thanks.
>
> MoJo Risin
> --
> <snip>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.