<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Here's another way of doing capturing 'U' to initiate totaling of
dummy fields <br>
on a special control file screen - without ever putting user in
update mode.<br>
(If it were up to me, I'd make the user press 'T' for total and let
them always <br>
think 'U' is reserved for really doing an update to something, but
hey.):<br>
<br>
<font face="Courier New, Courier, monospace"> 1 ------- - -
- - - - - - - - - -<br>
If: '(input table)<br>
Then: end<br>
2 ------- - - - - - - - - - - - -<br>
@entsel If: @sn ne "2"<br>
Then: end 'not on totaling scrn, give fp normal ctrl<br>
3 ------- - - - - - - - - - - - -<br>
If:<br>
Then: cls("22")<br>
4 ------- - - - - - - - - - - - -<br>
If: 'could add H/F to this for print opts<br>
Then: eb="\r U \r-Total, Screen Number, \r X \r-Exit"<br>
5 ------- - - - - - - - - - - - -<br>
If: 'allow U, X or another valid scrn#<br>
Then: errorbox ("22","") eb,"","UX13"<br>
6 ------- - - - - - - - - - - - -<br>
If: @sk eq "BRKY" 'ignore cancel key<br>
Then: goto @entsel<br>
7 ------- - - - - - - - - - - - -<br>
If: @bk eq "X" 'wants to exit<br>
Then: pushkey "X"; end<br>
8 ------- - - - - - - - - - - - -<br>
If: @bk ne "U" 'wants to go to another scrn#<br>
Then: pushkey @bk; end</font><br>
<font face="Courier New, Courier, monospace"> 9 ------- - -
- - - - - - - - - -<br>
If: 'fell thru - U pressed--total dets into 'tl'<br>
Then: tl(10,.0)=""<br>
10 ------- - - - - - - - - - - - -<br>
If:<br>
Then: lookup dets = totdetails@ k=("BBB") i=A -nx<br>
11 ------- - - - - - - - - - - - -<br>
detsloo If: not dets 'done totaling BBB<br>
Then: display; goto @entsel<br>
12 ------- - - - - - - - - - - - -<br>
If: dets(1) ne "BBB" 'done totaling BBB<br>
Then: display; goto @entsel<br>
13 ------- - - - - - - - - - - - -<br>
If:<br>
Then: tl=tl+dets(2); getnext dets; goto detsloo</font><br>
<br>
Here, I'm trying to total all details that match 'BBB' from the file
<br>
'totdetails', and screen 2 is the 'special' screen with dummy field
'tl' <br>
to show a total. This control file also has a screen 1 and a screen
3 <br>
where real updates to the record can occur.<br>
<br>
Assumptions:<br>
<br>
1. This is a control file where, for the purposes of this function,
<br>
only one record needs to be accesssed.<br>
2. No writing is necessary to the control file record from the
special screen.<br>
<br>
This could easily be modified to work for several screens of the
same <br>
record where each had a different set of dummy fields.<br>
<br>
Lines 5-8 could be easily redone with a combo of show statements <br>
and waitkey I believe to give a more precise look and feel to what <br>
you have now (instead of using errorbox).<br>
<br>
I have to wonder, though, why not just do the totaling as soon as <br>
someone arrives at the special screen (from @entsel and just test <br>
for the screen number)? Unless it takes a really long time and <br>
they might hit that screen number by mistake. But even in that
case, <br>
you could just ask before starting the totaling with a (i.e., yes/no
<br>
errorbox) and then switch/restore a previous screen if they really
didn't <br>
mean to go there. That would also keep control of this in just <br>
@entsel.<br>
<br>
Bruce<br>
<br>
Bruce Easton<br>
STN, Inc.<br>
<br>
<br>
<br>
<br>
On 12/3/10 11:00 PM, Boaz Bezborodko wrote:
<blockquote cite="mid:4CF9BCE7.8060205@mirrotek.com" type="cite">
<pre wrap="">I'm sure that many of you probably already have this as a tool in your
toolbox, but I figured I'd just share a simple way I used to trap an
Update in a specific screen.
The core of our software was written about 20 years ago and included a
control file that also contained pertinent daily information such as
daily and monthly sales totals. One screen was used to allow you to
total up all existing open AR invoices, open AP invoices, and open
orders. It would do this in one screen that contained a slew of dummy
variables. Once we started doing a lot of business that required large
amounts of dropship orders (each package requires its own order,
invoice, etc.) this record started to get a lot of activity and totaling
up these numbers in the screen could freeze other people until the
totals were completed and unlocked. The totaling routine looked at
other files and didn't touch anything in the record itself.
Obviously totaling from within the record was not a good idea and I
wanted to have this done from within @entsel which wouldn't lock the
record. But I didn't want to change the look and feel of the program
which entailed that people hit "U" to start the process. I was thinking
of trapping "U" with an @keyU, but that meant that I would have to have
a different line to jump to each of the other screens someone might want
to update.
The solution was to have a @WEF for the first field in this screen's
cursor path that looked something like this:
@wefaa if:
then: DECLARE What_Mode(7,*,g)
if:
then: What_Mode="Totals" ; ESCAPE
@Entsel if: What_Mode="Totals"
then: Gosub (routine) ; What_Mode="" ; GOTO @Entsel
Now the users can run this routine to their hearts content without
interrupting anyone else. The @Entsel and "What_Mode" trick I learned
from John Esak.
Just in case this helps anyone else.
Boaz
_______________________________________________
Filepro-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Filepro-list@lists.celestial.com">Filepro-list@lists.celestial.com</a>
Subscribe/Unsubscribe/Subscription Changes
<a class="moz-txt-link-freetext" href="http://mailman.celestial.com/mailman/listinfo/filepro-list">http://mailman.celestial.com/mailman/listinfo/filepro-list</a>
</pre>
</blockquote>
<br>
</body>
</html>