poplist

How to populate poplist item?

Your client has a form that contains a product description. They don’t want that their data entry staffs to type a product description. You, as a programmer, have been asked to change their form so that the product description item is populated from the PRODUCT table. They therefore are able to select the product description. You need to change the “text item” object to the “list item” object with the item type as “poplist.”

Solution:

=========

Assuming that you have a form that has an item that contains the product description.

1- Go to the object navigator window and open the “product description” property palette.

2- Change “item type” to “list item.”

3- Make sure that “list style” is “poplist.”

4- Open the “Elements in list.” You do this just to avoid getting an error regarding with the “No value defined in the list item” error message.

5- Type “A” in “List Elements.”

6- Type “A” in “List Item Value.”

7- Close the “product description” property palette.

8- Create a record group and name it “rg_prod_desc” with the

following query:

(Make sure that the “Based on the query below” option is selected.)

SELECT descrip A, descrip B

FROM product

ORDER BY 1 -- do not type “;” at the end.

Note that you must define the descrip column twice. The first one is for label, and the second one is for the value.

9- Open the “rg_prod_desc” property palette and change the “Name” item and the “Record Group Fetch Size” item to your desire value.

For example:

Change “Name” to “rg_prod_desc.”

Change “Record Group Fetch Size” to 10.

10-Close the property palette.

11- Create the “WHEN_NEW_FORM_INSTANCE” trigger with the following code:

DECLARE

STATUS NUMBER;

Problem EXCEPTION;

BEGIN

-- to populate the group

STATUS:=POPULATE_GROUP('RG_PROD_DESC');

-- Check that the select statement was executed successfully.

IF STATUS <> 0 THEN

RAISE problem;

ELSE

-- to populate the list item

POPULATE_LIST('DESCRIP', 'RG_PROD_DESC');

END IF;

EXCEPTION

WHEN problem THEN

MESSGAE ('We have a problem to query the PRODUCT table.');

END;

12- Compile and close the trigger.

13- Run the form, go to the product description item, and click on the description poplist. You should see the items listed.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值