Re: Forms 4.5 Running Totals
Date: 1995/07/17
Message-ID: <ADuTh2my9C_at_investor.kharkov.ua>#1/1
cz0763%zip02_at_mt.gov (Tony Noble) wrote at 12 Jul 1995 14:25:34 GMT
>In article <950707090451_702420.204300_BHD54-29_at_CompuServe.COM>,
>Graeme_King_at_tjhouse.ccmail.compuserve.com says...
>>
>> Can anybody supply a solution to this problem?
>>
>> I have a multi-record block (displaying 5 records) based on a
table,
>> called for example EMP. The block has an item called SALARY in it.
>>
>> I want a text item (on a different block) which is a total of the
>> SALARY column for all records queried (which may be one, many or
all
>> of the records in the table EMP).
>>
>> I tried a POST-QUERY trigger to calculate the total salary but it
only
>> fired 5 times i.e for each displayed record although there were
more
>> than 5 that meet the query criteria. When I scrolled down one
record
>> it fired again and updated the total salary. No good.
>>
>>
>> Thanks in advance...
>>
>>
>>
>> Graeme King
>> Information Systems Engineer
>> Information Services
>> Strathkelvin District Council
>>
>> email : graeme_king_at_tjhouse.ccmail.compuserve.com
>>
>I have a partial solution for you (I had to do this a few years ago for
>a time-keeping system). What you need to use are the built-in
>procedures, LAST_RECORD and FIRST_RECORD.
>
>Last_record will force forms to finish retreiving all the records and
>your existing post-query trigger will handle the running total.
>First_record will cause forms to reposition the records so that it
>doesn't show that you navigated to the last record.
>
>The tricky part, and the part that I can't remember exactly, is where to
>put the calls to last_record and first_record. These are restricted
>procedures, so you can't put them just anywhere. Also, you only want
>them to execute once. If I remember correctly I had a field where the
>user put in their social security number and then I had a key-next-field
>trigger that retrieved their time-keeping records. The
>last_record/first_record calls probably would go right after the
>execute_query call for the multi-line block. Anyway, a little
>experimentation should find a good place to place them.
>
>I hope this helps,
>Tony Noble
>cz0763%zip02_at_mt.gov
>
Possibly a better way is to use ON-SELECT TRGGER with
EXEQUTE_QUERY(ALL_RECORDS) call.
Alexandr Alesinsky
JSV Investor
Received on Mon Jul 17 1995 - 00:00:00 CEST
