Post-Query Samples

Perform an action after fetching a record, such as looking up values in other tables based on a value in the current record. Fires once for each record fetched into the block.

Description
When a query is open in the block, the Post-Query trigger fires each time Form Builder fetches a record into a block. The trigger fires once for each record placed on the block's list of records.
Definition Level form or block

Legal Commands
SELECT statements, unrestricted built-ins
Enter Query Mode no

Usage Notes
Use a Post-Query trigger to perform the following tasks:
*populate control items or items in other blocks
*calculate statistics about the records retrieved by a query
*calculate a running total
*When you use a Post-Query trigger to SELECT non-base table values into control items, Form Builder marks each record as CHANGED, and so fires the When-Validate-Item trigger by default. You can avoid the execution of the When-Validate-Item trigger by explicitly setting the Status property of each record to QUERY in the Post-Query trigger. To set record status programmatically, use SET_RECORD_PROPERTY .

On Failure
Form Builder flushes the record from the block and attempts to fetch the next record from the database. If there are no other records in the database, Form Builder closes the query and waits for the next operator action.

Sample 1

This example retrieves descriptions for code fields, for display in non-database items in the current block.

DECLARE 
 
  CURSOR lookup_payplan IS SELECT Payplan_Desc 
                             FROM Payplan 
                            WHERE Payplan_Id = 
                                  :Employee.Payplan_Id; 
 
  CURSOR lookup_area    IS SELECT Area_Name 
                             FROM Zip_Code 
                             WHERE Zip = :Employee.Zip; 

BEGIN 
  /* 
  ** Lookup the Payment Plan Description given the 
  ** Payplan_Id in the Employee Record just fetched. 
  ** Use Explicit Cursor for highest efficiency. 
  */ 
  OPEN lookup_payplan; 
  FETCH lookup_payplan INTO :Employee.Payplan_Desc_Nondb; 
  CLOSE lookup_payplan; 
 
  /* 
  ** Lookup Area Descript given the Zipcode in 
  ** the Employee Record just fetched. Use Explicit 
  ** Cursor for highest efficiency. 
  */ 
  OPEN lookup_area; 
  FETCH lookup_area INTO :Employee.Area_Desc_Nondb; 
  CLOSE lookup_area; 
END; 



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值