<!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">&nbsp;&nbsp; 1 -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp;
      -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If: '(input table)<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: end<br>
      &nbsp;&nbsp; 2 -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -<br>
      @entsel&nbsp; If: @sn ne "2"<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: end&nbsp; 'not on totaling scrn, give fp normal ctrl<br>
      &nbsp;&nbsp; 3 -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If:<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: cls("22")<br>
      &nbsp;&nbsp; 4 -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'could add H/F to this for print opts<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: eb="\r U \r-Total, Screen Number, \r X \r-Exit"<br>
      &nbsp;&nbsp; 5 -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'allow U, X or another valid scrn#<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: errorbox ("22","") eb,"","UX13"<br>
      &nbsp;&nbsp; 6 -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If: @sk eq "BRKY"&nbsp;&nbsp; 'ignore cancel key<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: goto @entsel<br>
      &nbsp;&nbsp; 7 -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If: @bk eq "X"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'wants to exit<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: pushkey "X"; end<br>
      &nbsp;&nbsp; 8 -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If: @bk ne "U"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'wants to go to another scrn#<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: pushkey @bk; end</font><br>
    <font face="Courier New, Courier, monospace">&nbsp;&nbsp; 9 -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp;
      -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If:&nbsp;&nbsp; 'fell thru - U pressed--total dets into 'tl'<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: tl(10,.0)=""<br>
      &nbsp; 10 -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If:<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: lookup dets = totdetails@&nbsp; k=("BBB") i=A -nx<br>
      &nbsp; 11 -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -<br>
      detsloo&nbsp; If: not dets&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'done totaling BBB<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: display; goto @entsel<br>
      &nbsp; 12 -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If: dets(1) ne "BBB"&nbsp;&nbsp; 'done totaling BBB<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: display; goto @entsel<br>
      &nbsp; 13 -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If:<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.&nbsp; 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)?&nbsp; Unless it takes a really long time and <br>
    they might hit that screen number by mistake.&nbsp; 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.&nbsp; 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>