Oracle9iAS Portal Developer Kit

copy_attribute_value procedure

Contained in package wwa_api_module_session.

Call this procedure to copy attribute values into the other instances of the same attribute.

If no attribute name is specified, the p_source_index instance of each attribute in p_block_name is copied into either:

  • p_dest_index instance or,
  • p_source_index+1 through p_last_dest_index instances

depending on what information is specified.

Note: To do a bulk copy, only specify p_last_dest_index. If both p_dest_index and p_last_dest_index are specified, then p_dest_index overrides p_last_dest_index.

member procedure copy_attribute_value
    (
        p_attribute_name in varchar2 default null,
        p_block_name in varchar2,
        p_source_index in integer default 1,
        p_dest_index in integer default null,
        p_last_dest_index in integer default null
    )

Version: Oracle Portal 3.0.9.8.3

Parameters:

p_attribute_name

The name of the attribute.

Datatype: varchar2

p_block_name

The name of the block that owns the attribute.

Datatype: varchar2

p_source_index

The instance of the attribute from which the value is to be copied. 

Datatype: integer
Default: 1

p_dest_index

The instance of the attribute into which the value is to be copied .

Datatype: integer
Default: null

p_last_dest_index

The last instance of the attribute into which the value is to be copied, i.e. used when the value is to be copied into more than one instance.

Datatype: integer
Default: null

Exceptions:

If both p_dest_index and p_last_dest_index are not specified, an error is raised.

Example:

Consider a master-detail form component with 50 detail rows. For the detail section, i.e. the DETAIL_BLOCK, the default value of the 1st instance of HIREDATE is set and the value copied into the remaining instances (rather than setting the value for each instance). To set default values for the SAL attribute (instances 7 through 37), set the default value of the 7th instance and then copy this value into instances 8-37:

declare
        l_session wwa_api_module_session;
begin
        l_session := <portal_schema>.wwa_api_module_session.create_session (
                           p_module_id => 9,
                           p_version => 1);

        l_session.set_attribute_default (
            p_attribute_name => 'A_HIREDATE',
            p_block_name => 'DETAIL_BLOCK',
            p_index => 1,
            p_language => <portal_schema>.wwctx_api.get_nls_language);

        l_session.copy_attribute_value(
            p_attribute_name => 'A_HIREDATE',
            p_block_name => 'DETAIL_BLOCK',
            p_last_dest_index => 50);

        l_session.set_attribute_default (
            p_attribute_name => 'A_SAL',
            p_block_name => 'DETAIL_BLOCK',
            p_index => 7,
            p_language => <portal_schema>.wwctx_api.get_nls_language);

        l_session.copy_attribute_value(
            p_attribute_name => 'A_SAL',
            p_block_name => 'DETAIL_BLOCK',
            p_source_index => 7,
            p_last_dest_index => 37);
end;
   

Related topics

The PL/SQL API Reference is part of the Portal Developer Kit on Portal Studio