我如何才能使Apex oracle在交互式网格中强制添加至少一行 [英] How I can make Mandatory add at least one row in Interactive grid in apex oracle

查看:197
本文介绍了我如何才能使Apex oracle在交互式网格中强制添加至少一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两种区域一种形式,一种交互式网格,如主数据(公司和公司联系人),我如何使交互式网格成为强制性的,用户无法提交页面,他/她需要添加至少一行在交互式网格中, 我可以这样做,或者我需要将交互式网格更改为收集并计数验证中的行

I have two region one form and one interactive grid like a master detail(company and company contact person ) how i can make the interactive grid mandatory ,the user can't submit page ,he/she need add at least one row in interactive grid , I can do that or I need to change the interactive grid to collection and count the row in validation

推荐答案

由于交互网格的处理和验证方式(每提交一行执行一次),这一技巧有些棘手.要变通解决此问题,我将使用一个页面项目和一个与其一起使用的验证.

This one is a little tricky because of the way processes and validations work with Interactive Grids (they are executed once per submitted row). To work around this, I'll use a page item and a validation that works with it.

此解决方案的基本思想基于以下事实:新行将没有主键值.复制的步骤如下(我的示例在第14页上,请根据需要更新以下内容).

The basic idea of this solution is based on the fact that a new row will not have a primary key value. Here are the steps to reproduce (my example was on page 14, update the following as needed).

  1. 创建一个交互式网格(IG)区域.主键列应为仅查询"(以确保新行为空).
  2. 创建一个名为P14_NULL_FOUND的隐藏页面项目.将服务器端条件"下的类型"设置为从不",这样它就永远不会在页面上呈现.
  3. 创建一个提交后(验证之前)"过程.该过程不会与IG关联,因此只会触发一次.将PL/SQL代码属性设置为:

  1. Create an Interactive Grid (IG) region. The primary key column should be Query Only (which ensures it's null for new rows).
  2. Create a Hidden page item named P14_NULL_FOUND. Set Type under Server-side Condition to Never so that it never renders on the page.
  3. Create an After Submit (before Validations) process. This process will NOT be associated with the IG so it will only fire once. Set the PL/SQL Code attribute to:

:P14_NULL_FOUND := 'NO';

这将在下一步之前清除页面项目的值.

That will clear out the value of the page item prior to the next process.

创建另一个上一个提交之后的提交后"过程.将可编辑区域"设置为IG.然后将PL/SQL代码设置为如下所示:

Create another After Submit process that runs just after the previous one. Set Editable Region to the IG. Then set the PL/SQL Code to something like the following:

if :PK_COLUMN_IN_IG is null
then
  :P14_NULL_FOUND := 'YES';
end if;

您需要用IG中主键列的名称替换:PK_COLUMN_IN_IG",例如:EMPNO".对于IG中的每个提交的行,此过程将运行一次.如果主键列的值为空,则意味着用户添加了新行,并且P14_NULL_FOUND的值将设置为是".

You'll need to replace ":PK_COLUMN_IN_IG" with the name of the primary key column in the IG, such as ":EMPNO". This process will be run once for each submitted row in the IG. If a null value is found for the primary key column, then that would mean the user added a new row and the value of P14_NULL_FOUND would be set to 'YES'.

创建一个新的验证.该验证将不会与IG关联,因此只会触发一次.将类型设置为PL/SQL表达式.将PL/SQL表达式设置为:

Create a new validation. This validation will NOT be associated with the IG so it will only fire once. Set Type to PL/SQL Expression. Set PL/SQL Expression to:

:P14_NULL_FOUND != 'NO'

然后将错误消息设置为相关内容.

Then set Error Message to something relevant.

这时,您应该能够运行页面并验证流程和验证是否正常工作.

At this point, you should be able to run the page and verify that the processes and validation are working correctly.

这篇关于我如何才能使Apex oracle在交互式网格中强制添加至少一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆