更改动态Oracle Apex报表上的字段 [英] Changing fields on dynamic oracle apex report

查看:316
本文介绍了更改动态Oracle Apex报表上的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此处既不是新手也不是高级顶点用户,
但是,
我对主要的客户端网络语言非常幼稚,现在我需要面对它.很快.
我有一个示例此处-用户: test 和密码 test . 我基于这里,由托尼·安德鲁斯先生回答. 在我的应用示例中,当更改 priority 字段时,它会将 A 字段的值设置为0或null.它只是将结果乘以该字段.
我试图在更改时将优先级字段中的更改优先级脚本放入.例如:将 id = 1 的优先级更改为1时,必须将 id = 2 的优先级更改为 3 - id = 1 中的原始优先级.
我知道这是一个非常基本的算法,但是我不知道如何及时地在apex上的javascript或jQuery调用上做到这一点.我一直在尝试对报表进行更复杂的操作,但是我需要首先了解基础知识.

Nor newbie and nor advanced apex user here,
But,
I'm very naive on major client side web languages, and now I need to face it. And soon.
I have an example here - user : test and password test. I'm based on the very same jquery and javascript function from here, answered by Mr. Tony Andrews. At my app example, when the priority field is changed it puts in the value of A field, when its not 0, nor null . Its simply multiply the result in that field.
I'm trying to put a change priority script from priority field when its change. For example: When would change the priority of id=1, to 1, the priority from id=2 must be changed to 3 - the original priority from id=1.
I know it's a very basic algorithm, but I don't know how to do it just in time, on javascript or jQuery calls on apex. I'm been trying to more complex manipulations on report, but I need to understand the basics first.

为澄清起见,我的查询报告和javascript执行如下:

For clarification my query report and javascript execution is:

select distinct
apex_item.checkbox2(10,r.ID) ID,
apex_item.text(11,r.ID) ID_2,
apex_item.text(20,r.PRIORIDADE) PRIORITY,
apex_item.text(30,1) a,
apex_item.SELECT_LIST_FROM_LOV(31,r.PRIORIDADE,'LISTAPRIORIDADES',NULL,'NO') PRIORITY_LOV, 
apex_item.text(40,null) b,


(select seq_id from apex_collections c  where collection_name = 'COLECAO'  AND c001 = r.id
)sequencial
from REPRIORIZA r



order by id;    
     //javascript execution, on dynamic action:

    var target = apex.jQuery(this.triggeringElement).closest('tr').find('input[name="f30"]')
    console.log(target)
    var source = apex.jQuery(this.triggeringElement).closest('tr').find('input[name="f20"]')
    console.log(source)
    var result = target.val() * source.val();
    target.val(result);
    console.log(target)

        var target2 = apex.jQuery(this.triggeringElement).closest('tr').find('input[name="f40"]')
        console.log(target)
        var source2 = apex.jQuery(this.triggeringElement).closest('tr').find('input[name="f11"]')
        console.log(source2)
        var result2 = source2.val();
        target2.val(result2);

此致

推荐答案

有几种方法可以做到这一点,我的建议如下:

There are a few ways to do this, my suggestion is as follows:

1-编写apex_item代码时,请在选择中使用属性'p_attributes'和'p_item-id',例如:

1 - Use the attributes 'p_attributes' and 'p_item-id' in your select when do you write apex_item code, like this:

https://docs.oracle.com /cd/E14373_01/apirefs.32/e13369/apex_item.htm#AEAPI211

https://docs.oracle.com /cd/E14373_01/apirefs.32/e13369/apex_item.htm#AEAPI206

apex_item.text(
    p_idx  => 20,
    p_value => 1,
    p_attributes  => 'data-id="' || CUSTOMER_ID || '"',
    p_item_id => 'priority' || CUSTOMER_ID) 
priority,
apex_item.text(
    p_idx => 30,
    p_value => 1,
    p_attributes  => 'data-id="' || CUSTOMER_ID || '"',
    p_item_id => 'a' || CUSTOMER_ID) 
a,
apex_item.SELECT_LIST_FROM_LOV(
    p_idx => 31,
    p_value  => 1,
    p_lov  => 'LISTAPRIORIDADES',
    p_attributes  => 'data-id="' || CUSTOMER_ID || '"',
    p_show_null => 'NO',
    p_item_id => 'lov' || CUSTOMER_ID)
PRIORITY_LOV

执行此操作时,您可以轻松地从同一行访问每个项目.这些选择来自我的工作区中的示例表,将这些数据调整为您的表.

When you do this, you can access every item from the same line easily. These select is from a example table in my workspace, adapt these data to your table.

2-创建一个动态操作以在更改lov时触发,此动态操作应执行javascript代码.

2 - Create a dynamic action to trigger when change the lov, this dynamic action should execute a javascript code.

3-在此DA的javascript代码中,您可以使用以下代码获取该行的每个元素:

3 - In your javascript code of this DA you can get every element of the line with this code:

var lineId = this.triggeringElement.getAttribute('data-id');
var lovItem = document.getElementById('lov' + lineId);
var aItem = document.getElementById('a' + lineId);
var priorityItem = document.getElementById('priority' + lineId);

现在,您可以使用lovItem,aItem和priorityItem字段进行所有操作.

Now you can do everything with lovItem, aItem and priorityItem fields.

4-在示例页面中,id列是连续的,因此只需增加lineId变量即可获得下一行:

4 - in your example page, the id column are sequential, so you can get the next line just incrementing the lineId variable like this:

var nextLineId = lineId + 1;
var nextLovItem = document.getElementById('lov' + nextLineId);
var nextAItem = document.getElementById('a' + nextLineId);
var nextPriorityItem = document.getElementById('priority' + nextLineId);

*如果值不是连续的,也许您可​​以使用超前或滞后函数在apex_item上的"p_attributes"参数上创建另一个属性. https://oracle-base.com/articles/misc/lag-线索分析功能

*If the values are not sequential, maybe you can create one more attribute in your apex_item on the "p_attributes" parameter using lead or lag function. https://oracle-base.com/articles/misc/lag-lead-analytic-functions

这篇关于更改动态Oracle Apex报表上的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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