peoplesoft中利用checkbox实现多值选择,修改

来源:互联网 发布:mac西柚色口红多少号 编辑:程序博客网 时间:2024/04/29 07:18

大概任务如下:任务大概要求

(图p-1-1) 

     添加兴趣爱好

(图p-1-2)

第一张页面为添加用户,第二张页面为添加兴趣爱好.在这里我们讨论怎样用peoplesoft实现如下图所示的功能。

兴趣爱好

(图p-1-3)

在用户填写p-1-1页面的数据时可以通过“爱好”选项中的checkbox来选择兴趣爱好,并可通过p-1-3来修改兴趣爱好。

就以上内容我们建立三张数据存储的record;一张userinfo_tbl,存储p-1-1中用户信息内容;一张interest_tbl,存储p-1-2中添加的兴趣爱好内容;一张userinterest_rel_tbl,存储用户兴趣爱好关联表;另外建立derived/work类型的temp_wrk的record。

表结构如下:

userinfo_tbl(

   user_no  number key,

   user_name character,

   ...  ...

);

interest_tbl(

    inte_id number key,

    inte_name  character

);

 

userinterest_rel_tbl(

     ui_user_no;

     ui_inte_id;

);

temp_wrk(

      jt_temp1_field  character(1),

      jt_temp2_field  character(1)

);

其中,jt_temp1_field的translate values值为:
Field value:Y    long name Y     short name Y;

Field value:N    long name N     short name N;

 

注:本文重点讨论用checkbox实现多值选取,修改。如图 p-1-3。其他操作,代码全部省列。

 

图p-1-3整体为一个grid,总共四个字段,最后两个字段隐藏。

checkbox 与temp_wrk.jt_temp1_field关联;兴趣爱好显示列与interest_tbl.inte_name关联;

第三列与interest_tbl.inte_id关联,并隐藏(因为此字段不需显示,但向userinterest_rel_tbl插数据时需要这个字段的值);

第四列与temp_wrk,jt_temp2_field关联,并隐藏,辅助列。

 

temp_wrk.jt_temp1_field    fieldChange事件添加以下代码:

 

rem if the field value is N,then delete userinterest_rel_tbl data;
rem if the field value is Y,then insert data to userinterest_rel_tbl record;

 

If temp_wrk.jt_temp1_field= "N" Then
        &sql = CreateSQL("delete from PS_USERINTEREST_REL_TBL tbl where tbl.UI_USER_NO,=:1");
        &sql.Execute(USERINFO_TBL.USER_NO);      
   Else
      &sql = CreateSQL("insert into PS_USERINTEREST_REL_TBL(UI_USER_NO,

                 UI_INTE_ID) values(:1,:2)");
      &sql.Execute(USERINFO_TBL.USER_NO, INTEREST_TBL.INTE_ID);   

   End-If;

 

temp_wrk.jt_temp2_field   rowinit事件添加以下代码:

 

 

Local array of number &hIds;
Local SQL &sql;
Local number &hId;

 

&hIds = CreateArray(&hId, 0);


&sql = CreateSQL("SELECT  UI_INTE_ID FROM PS_USERINTEREST_REL_TBL

                              where UI_USER_NO= :1", USERINFO_TBL.USER_NO);
While &sql.Fetch(&hId)
   &hIds.Push(&hId);
End-While;

 

For &i = 0 To &hIds.Len
   &k = &hIds.Find(INTEREST_TBL.INTE_ID);
   If &k = 0 Then
      temp_wrk.jt_temp1_field= "N";
   Else
      temp_wrk.jt_temp1_field= "Y";
   End-If;
End-For;

以上就可以实现在checkbox中任意修改,当添加兴趣爱好以后,后及时反映到添加user页面之上供选择。

(本文版权所有,如需转载,请注明出处)

原创粉丝点击