Adsense Ad

Monday 8 May 2017

Oracle Forms: Set Block Property

SET_BLOCK_PROPERTY built-in

Description

Sets the given block characteristic of the given block.

Syntax

SET_BLOCK_PROPERTY (block_id Block, property VARCHAR, value VARCHAR);

SET_BLOCK_PROPERTY (block_id Block,
property VARCHAR, x NUMBER);

SET_BLOCK_PROPERTY (block_id Block,
property VARCHAR,

x       NUMBER
y       NUMBER);

SET_BLOCK_PROPERTY (block_name VARCHAR2,
property VARCHAR, value VARCHAR);

SET_BLOCK_PROPERTY (block_name VARCHAR2,
property VARCHAR, x NUMBER);

SET_BLOCK_PROPERTY (block_name VARCHAR2,
property         VARCHAR,
x       NUMBER,
y       NUMBER);

Built-in Type  unrestricted procedure

Enter Query Mode  yes

Parameters

block_id                                    The unique ID Form Builder assigned to the block when you created it.

Datatype is BLOCK.

block_name                              The name you gave the block when you created it.  Datatype is

VARCHAR2.

property                                    Specify one of the following constants:

ALL_RECORDS Specifies whether all the records matching the query

criteria should be fetched into the data block when a query is executed.

BLOCKSCROLLBAR_POSITION              Specifies both the x and y positions

of the block’s scroll bar in the form coordinate units indicated by the

Coordinate System form property.






BLOCKSCROLLBAR_X_POS Specifies the x position of the block’s scroll bar in the form coordinate units indicated by the Coordinate System form property.

BLOCKSCROLLBAR_Y_POS Specifies the y position of the block scroll bar in the form coordinate units indicated by the Coordinate System form property.

COORDINATION_STATUS Specifies a status that indicates whether a block that is a detail block in a master-detail relation is currently coordinated with all of its master blocks; that is, whether the detail records in the block correspond correctly to the current master record in the master block. Valid values are COORDINATED and NON_COORDINATED

CURRENT_RECORD_ATTRIBUTE Specify the VARCHAR2 name of a named visual attribute to be associated with the given block. If the named visual attribute does not exist, you will get an error message.

CURRENT_ROW_BACKGROUND_COLOR The color of the object’s background region.

CURRENT_ROW_FILL_PATTERN The pattern to be used for the object’s fill region. Patterns are rendered in the two colors specified by Background Color and Foreground Color.

CURRENT_ROW_FONT_NAME The font family, or typeface, that should be used for text in the object. The list of fonts available is system-dependent.

CURRENT_ROW_FONT_SIZE The size of the font, specified in points.

CURRENT_ROW_FONT_SPACING The width of the font, that is, the amount of space between characters (kerning).

CURRENT_ROW_FONT_STYLE  The style of the font.

CURRENT_ROW_FONT_WEIGHT The weight of the font.

CURRENT_ROW_FOREGROUND_COLOR The color of the object’s foreground region. For items, the Foreground Color attribute defines the color of text displayed in the item.

CURRENT_ROW_WHITE_ON_BLACK Specifies that the object is to appear on a monochrome bitmap display device as white text on a black background.

DEFAULT_WHERE Specifies a default WHERE clause for the block, overriding previous WHERE clauses. (Note: this will not override a value established at design time via the Property Palette for the data block’s WHERE clause property.)

Enclose in single quotes. The WHERE reserved word is optional. The default WHERE clause can include references to global variables, form parameters, and item values, specified with standard bind variable syntax.

DELETE_ALLOWED Specifies whether the operator or the application is allowed to delete records in the given block. Valid values are PROPERTY_TRUE or PROPERTY_FALSE.




DML_DATA_TARGET_NAME Specifies the name of the block’s DML data source.

ENFORCE_PRIMARY_KEY Specifies that any record inserted or updated in the block must have a unique characteristic in order to be committed to the database. Valid values are PROPERTY_TRUE or

PROPERTY_FALSE.

INSERT_ALLOWED Specifies whether the operator or the application is allowed to insert records in the given block. Valid values are PROPERTY_TRUE or PROPERTY_FALSE.

KEY_MODE Specifies the key mode for the block. This is particularly useful when running Form Builder against non-ORACLE data sources. Valid values are UPDATEABLE_PRIMARY_KEY and

NONUPDATEABLE_PRIMARY_KEY.

LOCKING_MODE Specifies the block’s LOCKING_MODE property. Valid values are DELAYED or IMMEDIATE.

MAX_QUERY_TIME Specifies the maximum query time. The operator can abort a query when the elapsed time of the query exceeds the value of this property.

MAX_RECORDS_FETCHED Specifies the maximum number of records that can be fetched. This property is only useful when the Query All Records property is set to Yes.

NAVIGATION_STYLE Specifies the block’s NAVIGATION_STYLE property. Valid values are SAME_RECORD, CHANGE_RECORD, or

CHANGE_BLOCK.

NEXT_NAVIGATION_BLOCK Specifies the name of the block’s next navigation block. By default, the next navigation block is the block with the next higher sequence number; however, the NEXT_NAVIGATION_BLOCK block property can be set to override the default block navigation sequence.

OPTIMIZER_HINT Specifies a hint that Form Builder passes on to the RDBMS optimizer when constructing queries. This allows the form designer to achieve the highest possible performance when querying blocks.

ORDER_BY Specifies a default ORDER BY clause for the block, overriding any prior ORDER BY clause. Enclose in single quotes but do not include the actual words ’ORDER BY’. Form Builder automatically prefixes the statement you supply with "ORDER BY."

PRECOMPUTE_SUMMARIES[Under Construction]

PREVIOUS_NAVIGATION_BLOCK Specifies the name of the block’s previous navigation block. By default, the previous navigation block is the block with the next lower sequence number; however, the NEXT_NAVIGATION_BLOCK block property can be set to override the default block navigation sequence.

QUERY_ALLOWED Specifies whether a query can be issued from the block, either by an operator or programmatically. Valid values are PROPERTY_TRUE or PROPERTY_FALSE.






QUERY_DATA_SOURCE_NAME     Specifies the name of the block’s

query data source.  Note: You cannot set a blocks’

QUERY_DATA_SOURCE_NAME when the block’s datasource is a

procedure.

QUERY_HITS Specifies the NUMBER value that indicates the number of

records identified by the COUNT_QUERY operation.

UPDATE_ALLOWED Specifies whether the operator or the application

is allowed to update records in the given block. Valid values are

PROPERTY_TRUE or PROPERTY_FALSE.

UPDATE_CHANGED_COLUMNS  Specifies that only those columns

updated by an operator will be sent to the database.  When Update Changed

Columns Only is set to No, all columns are sent, regardless of whether they

have been updated.  This can result in considerable network traffic,

particularly if the block contains a LONG data type.

value                                          The following constants can be passed as arguments to the property values

described earlier:

COORDINATED Specifies that the COORDINATION_STATUS

property should be set to COORDINATED for a block that is a detail block

in a master-detail relation.

DELAYED Specifies that you want Form Builder to lock detail records

only at the execution of a commit action.

IMMEDIATE  Specifies that you want Form Builder to lock detail records

immediately whenever a database record has been modified.

NON_COORDINATED  Specifies that the COORDINATION_STATUS

property should be set to NON_COORDINATED for a block that is a

detail block in a master-detail relation.

NON_UPDATEABLE_PRIMARY_KEY  Specifies that you want Form

Builder to process records in the block on the basis that the underlying data

source does not allow primary keys to be updated.

PROPERTY_TRUE    Specifies that the property is to be set to the TRUE

state.  Specifically, supply as the value for DELETE_ALLOWED,

INSERT_ALLOWED, QUERY_HITS, and UPDATE_ALLOWED.

PROPERTY_FALSE    Specifies that the property is to be set to the

FALSE state.

UNIQUE_KEY Specifies that you want Form Builder to process records

in the block on the basis that the underlying data source uses some form of

unique key, or ROWID.

UPDATEABLE_PRIMARY_KEY  Specifies that you want Form Builder

to process records in the block on the basis that the underlying data source

allows for primary keys to be updated.

x                                                 The NUMBER value of the axis coordinate specified in form coordinate

system units.  If setting both x and y positions this value refers to the x

coordinate.  When setting the y position only, this value refers to the y

coordinate.


y                                                The NUMBER value of the y axis coordinate specified in form coordinate

system units.  This value applies when setting both x and y positions, and

can be ignored for all other properties.

SET_BLOCK_PROPERTY examples
/*

**  Built-in:  SET_BLOCK_PROPERTY
**  Example:   Prevent future inserts, updates, and deletes to
**                   queried records in the block whose name is
**                   passed as an argument to this procedure.
*/
PROCEDURE Make_Block_Query_Only( blk_name IN VARCHAR2 )
IS
blk_id Block;
BEGIN
/* Lookup the block’s internal ID */ blk_id := Find_Block(blk_name);
/*
**  If the block exists (ie the ID is Not NULL) then set
**  the three properties for this block. Otherwise signal
**  an error.
*/
IF NOT Id_Null(blk_id) THEN Set_Block_Property(blk_id,INSERT_ALLOWED,PROPERTY_FALSE); Set_Block_Property(blk_id,UPDATE_ALLOWED,PROPERTY_FALSE); Set_Block_Property(blk_id,DELETE_ALLOWED,PROPERTY_FALSE);
ELSE
Message(’Block ’||blk_name||’ does not exist.’); RAISE Form_trigger_Failure;
END IF; END;

Using BLOCKSCROLLBAR_POSITION: /*

**  Built-in:  SET_BLOCK_PROPERTY
**  Example:   Set the x and y position of the block’s scrollbar
**           to the passed x and y coordinates

*/
PROCEDURE Set_Scrollbar_Pos( blk_name IN VARCHAR2, xpos IN

NUMBER, ypos IN NUMBER )
IS
BEGIN
Set_Block_Property(blk_name, BLOCKSCROLLBAR_POSITION, xpos, ypos);

END;

2 comments:

Deepanshu khattar said...

Hi Hasan,

I am looking to implement this code in a situation where only some authorized user is able to edit the block and rest of the users have read-only access. I have tried to implement this on a pre-block trigger. Code works fine for authorised user but but throw unhandled exception for unauthorized users which I want to remove. Can you please help me in this regard?

Anonymous said...

brother,
I need to change scroll visible true false depends on list value changes. but i don't know the property of scroll bar . there is a property BLOCKSCROLLBAR_POSITION for position. I want to canvas null or visible true false. how many ways it can be possible?inform me please.