Form开发的小总结

Form 开发的一些小总结.当然要实现如下的功能不一定要这样做,但是下文的做法肯定是可以实现这个功能的,这些都是我在实际工作中使用过的。可能描述的不是很准确,大家不是很明白,但是可以试着操作,就知道了。

 

1. FORMwindows上显示名称:

在FORM级的trigger when_new_form_instance上设置如下:

set_window_property('MPOSRFQA',TITLE,'业务核价--'||sysdate);

显示效果如图:

Form

2. FORM中当某个Item的值为某个状态不可修改:

在block级的trigger pre_record中加入如下代码:

If :block_name.item_name = P_value then

Set_item_instance_property(‘Block_Name.Item_Name’,

                                           Current_record,

                                           Update_Allowed,

                                           Property_False);

Fnd_message.debug(‘item_name=P_value时不可以修改’);

End if;

3. 在某个Item下,当该Item为空时,它将复制这个Item的上一个值。

在该Item的trigger:when_new_form_instance下输入

If :block_name.item_name is null then

Duplicate_Item;

End if;

4. FORM中设置某个Item在某个条件下显示时:

在form 级trigger when_new_form_instance中加入如下代码:

If :parameter.p_select =’ENABLE’ then

App_item_property.set_property(‘Block_Name.Item_Name1’,visible,Property_On);

Else

App_item_property.set_property(‘Blocke_Name.Item_name1’,visible,Property_Off);

End if;

5. Go_block()

L_where :=’Item_Name=:Paramter.item_name1’;

Go_block(‘Block_name’);

Set_block_property(‘block_name’,Default_where,L_where||’Order by item_name2’);

Execut_Query;

go_block('block_name');

first_record;

loop             

        if :block_name.item_name1 ='Y'

             and :block_name.item_name2 is null then

        :block_name.item_name3 := :parameter.p_refno ;

       commit;

        end if;

        exit when :system.last_record='TRUE';

        next_record;

end loop;

6. calendar 日历设置--其实在以前我的form开发技术中已经说过了

设置item的lov属性(calendar)

务必在validate from list 处选择no

在Item trigger : Key_listval 中写上 calendar.show;

Calendar.show 是可以带参数的,缺省就是当天(可以打开attached libraries --> appdaypk --> calendar),其参数就是设日历的缺省date

For example : calendar.show(to_date(‘2009-08-29’,’YYYY-MM-DD’));

7.form调用window的例子

对于包含多个window的form在已打开的window上通过按钮打开另一个window

Begin

Show_window(‘TEST_WINDOW’,2,2);

Set_window_property(‘TEST_WINDOW’,title,’标题’);

End;

8.fnd_message.question

Declare

v_num number;

Begin

Fnd_message.set_string('确定执行此操作吗?');

v_num := fnd_message.question('否', '是', 1, 2);

if v_num = 2 then

fnd_message.debug('選擇了是');

elsif v_num = 1 then

fnd_message.debug('選擇了否');

end if;

end;

9.实现lov可自动录入内容

在item level 的when_new_item_instance trigger上加入

Begin

Set_item_property(‘block.item1’,validate_from_list,property_false);

End;

在item level的when_validate_item trigger上加入

If :block_name.item_name is not null then

Begin

Select item_name into :block_name.item_name

From table_name where ..... and item_name = :block_name.item_name

Exception when others then

Fnd_message.debug(‘......’);

End;

End if;

10. form中创建一个item,用于加总另一个item的值

(1)首先创建的Item必须与要统计值的Item在同一个block上.

(2)在创建好的item上的calculation中设置好相应的函数

(3)在这个item所对应的block上把advanced database中飞precompute summaries修改为Yes。

原文地址:https://www.cnblogs.com/quanweiru/p/2616110.html