GET_BLOCK_PROPERTY and QUERY_DATA_SOURCE_NAME
In order to check that a block is a db block ... i use the GET_BLOCK_PROPERTY using the QUERY_DATA_SOURCE_NAME as parameter.....
However , if even when i use explicitly the name of the form block ..., for example
:block_button.test:=get_block_property('DEPT_',QUERY_DATA_SOURCE_NAME);
the QUERY_DATA_SOURCE_NAME value is not displayed in a test block item which is of varchar2 datatype....?????
What do i make wrong ... ????
Thanks , a lot
Simon
Simon,
try
message('block name '|| :system.current_block);
block_button.test:=get_block_property( :system.current_block,QUERY_DATA_SOURCE_NAME);
Rajesh ALex
Similar Messages
-
Hi,
Does any one know how to find canvas and the block contents on that canvas?
I have a canvas and three blocks items are displayed. I want to find out the three block names of that canvas.
I know if there is a relationship I could find the previous and then the first block. But if there is no relationship how do you find the blocks name.
Thanks
LukshLook at the GET_BLOCK_PROPERTY and GET_ITEM_PROPERTY built-ins in the help documentation. There are these item properties you may be able to use to get want you want:
BLOCK_NAME
ITEM_CANVAS
ITEM_NAME
You will probably need to know the block names, then loop through the items in the block and get the canvas name using:
get_block_property('Block_Name', FIRST_ITEM)
get_block_property('Item_Name', LAST_ITEM)
get_item_property('Item_Name', NEXTITEM)
get_item_property('Item_Name', PREVIOUSITEM)
Other item properties are:
NEXT_NAVIGATION_ITEM
PREVIOUS_NAVIGATION_ITEM -
How can we use Prompt text from Field comment in database
After migrate database from 4 to 9, I'm getting the problem. The problem is Prompt text in Form don't appear. So, how can we get the Prompt text by using the comment of the field in database which it related with that database text. Thank you.
Hello,
The table name is indicated in the query data source name property of the block
Get_Block_Property( 'bloc_name', QUERY_DATA_SOURCE_NAME ) ;
The column name is indicated in the column name item property
Get_Item_Property( 'blk.item_name', COLUMN_NAME ) ;
Comment is stored in the user_col_comments view
Here is the code that retrieves coments for all based items of the current block:
Declare
LC$Table Varchar2(30);
LC$Column Varchar2(30);
LC$Item Varchar2(61);
LC$Comment USER_COL_COMMENTS.COMMENTS%Type ;
Begin
LC$Table := Get_Block_Property( :system.current_block, QUERY_DATA_SOURCE_NAME ) ;
-- For each item of the block --
LC$Item := Get_Block_Property( :system.current_block, FIRST_ITEM ) ;
Loop
LC$Column := Get_Item_Property( LC$Item, COLUMN_NAME ) ;
If LC$Column is not null Then
Begin
Select
COMMENTS
Into
LC$Comment
From
USER_COL_COMMENTS
Where
TABLE_NAME = LC$Table
And
COLUMN_NAME = LC$Column
-- set the prompt --
Set_Item_Property( LC$Item, PROMPT_TEXT, LC$Comment ) ;
Exception
When no_data_found Then
Null;
End;
End if ;
LC$Item := Get_Item_Property( LC$Item, NEXTITEM ) ;
Exit When LC$Item is null ;
End loop;
End;Francois -
How to generate a form with a data block with the "Update Changed Columns Only" property set to "yes" from Designer 9.0.4.6? Is there an equivalent for this property in Designer? Or do I have to create a library object which I then have to subclass from?
Thanks in advance
GeraldHi Gerald
When you look in the help of Designer (Generated data block properties (implicit/explicit)), the Forms property "Update Changed Columns Only" is not mentioned. That implies that there is no property/preference in Desinger that will influence the value of this Forms property.
So yes, you have to create a library object and subclass from it.
Another solution is to work with the Forms built-ins GET_BLOCK_PROPERTY and SET_BLOCK_PROPERTY in a Pre_Form trigger, but I personally would prefer a new library object for this.
Kind regards,
Lennart de Vos -
Dot notation in Forms6i ??
I would like to make a generic program unit that would loop through all the text items and change thier properties to show up with no BEVEL, blending into the background color and not being editable. This would be a query in report or display only mode (not a real Oracle Report, I don't want to maintain two different objects - a FORM for editing and a REPORT for display only). To EDIT I would have a button to change all the properties to the default or original ones.
I used to be able to do this in Power Builder, way back when, with dot notation.
WINDOW.FORM.BLOCK.TEXT_ITEM.NAME.PROPERTY := 'STRING';
and be able to change all the properties that were available for the TEXT_ITEMs in a loop of some kind.
Any information would be appreciated. Bill :)All the information you need is available through GET_BLOCK_PROPERTY and GET_ITEM_PROPERTY etc.
You can obtain the next iten relative to the current item and so on - not as neat as dot notation but workable -
Hi:
Since EXECUTE IMMEDIATE does not work in Forms 6i (PL/SQL 8.0.3) I was wondering how to tackle the following problem:
We use object libraries and assume the following code forms part of a standard trigger:
B is a variable set at runtime. I cant get this to compile.
DECLARE
b VARCHAR2(50) := Get_Block_Property ( :System.Trigger_block, Query_data_source_name );
TYPE refx IS REF CURSOR;
re refx;
BEGIN
OPEN re FOR select count(*) into v from ||b;
IF v = 0
THEN
.... do the right thing
END IF;
END;you can place execute immediate in a stored procedure and call this procedure from Forms
you can also use the FORMS_DDL() built-in -
Nested Tables and Advanced Queues- Please Help.
How do i work with NestedTable type and Advanced Queue.
I have done the following
I have Oracle 8.1.7 enterprise edition.
create type myType as TABLE OF varchar(32);
create type myObject as OBJECT (
id int,
myt myType);
DECLARE
BEGIN
dbms_aqadm.create_queue_table(
queue_table => 'my_queue_table',
multiple_consumers => TRUE,
queue_payload_type => 'myObject',
compatible => '8.1.3'
END;
The Nested Table and Object are created successfully.
but the queue is not created.
I get the following message.
DECLARE
ERROR at line 1:
ORA-22913: must specify table name for nested table column or
attribute
ORA-06512: at "SYS.DBMS_AQADM_SYS", line 2012
ORA-06512: at "SYS.DBMS_AQADM", line 55
ORA-06512: at line 3
I know how to specify the nested table storage clause for
create table statement, but there is no provision for
it in the create_queue_table procedure.
Any help will be greately appriciated.
i have already created and tested aqs with simple data types,
also i have created simple tables with nested table type
elements.
but the combo of Nested tables and AQ is not working.
thanks in advance.Hi Francois. Thank you very much for your reply, but it seems that i still get errors. So let me tell what i have done.
As you suggested me: i have done a block based on a sub-query for the nested-table:
'select courses from department where name= :department.name'.
In the master block(department) i have the when-new-record-instance trigger:
Declare
LC$Req varchar2(256);
Begin
LC$Req := '(select ns.courses from table
( select courses from department where name = ''' || :DEPARTMENT.name || ''' ) ns )';
Go_block('block11');
Clear_Block ;
Set_Block_Property( 'block11', QUERY_DATA_SOURCE_NAME, LC$Req ) ;
Execute_query ;
End ;
Now the errors i receive, this time in the runtime mode are:
- FRM-41380: Cannot set the blocks query data source
-FRM-41003: This function cannot be performed here.
Since it seems that you know how to work with the nested table i would really appreaciate your help. I am new in the nested table and if you could give an ex with my tables it would be great.
Thank you in advance. -
Can I show different fonts and colors text on 1 multi-line text fields?
I want to format different messages on 1 mutli-line field with different fonts and colors for the heading lines. Can I do that in Forms 6i ?
You must use in trigger Post-query the sentence:
Example:
DECLARE
cur_itm VARCHAR2(80);
cur_block VARCHAR2(80) := :System.Cursor_Block;
BEGIN
cur_itm := Get_Block_Property( cur_block, FIRST_ITEM );
WHILE ( cur_itm IS NOT NULL ) LOOP
cur_itm := cur_block||'.'||cur_itm;
Set_Item_Instance_Property( cur_itm, CURRENT_RECORD,
VISUAL_ATTRIBUTE,'My_Favorite_Named_Attribute');
cur_itm := Get_Item_Property( cur_itm, NEXTITEM );
END LOOP;
END; -
i hv 2 buttons one for upload and another for download
through webutil
i hv written this code but it is not inserting record into the table, thr r no records in the table, it is empty, when i try to upload .txt file it is showing me an error "missing expression" ORA-00936
the code is
declare
sMY_file varchar2(200);
v_Last_Directory Varchar2(2000);
v_Upload_Succes boolean;
nWHERE number(10);
OUT_DOC_ID number;
temp_id number;
doc_id_temp number;
v_status VARCHAR2(200);
BEGIN
OUT_DOC_ID:=:parameter.p_dealid; --:files.deal_id;
sMY_file := WebUtil_File.File_save_Dialog(v_Last_Directory,
'test',
'|All Files|*.*|',
'Select a file');
if OUT_DOC_ID is not null then
v_Upload_Succes := WebUtil_File_Transfer.Client_to_db(sMY_file,
'deal_document_file', -- TABLE name
'CONTENT' , -- columname
'deal_id||='||OUT_DOC_ID ||' and document_file_name='||:files.document_file_name -- where
elsif OUT_DOC_ID is null then
v_status := get_block_property('files',status);
temp_id:=get_id;
:files.deal_id:=temp_id;
:files.document_file_name:= substr(sMY_file,instr(sMY_file,'\',-1)+1);
insert into deal_document_file (deal_id,document_file_name) values
(:files.deal_id, :files.document_file_name);
commit;
v_Upload_Succes := WebUtil_File_Transfer.Client_to_db( sMY_file,
'deal_document_file', -- TABLE name
'CONTENT' , -- columname
'deal_id='||:files.deal_id||' and document_file_name='||:files.document_file_name
end if;
commit;
if (v_Upload_Succes) then
:files.maker:= sysuser;
:files.made_at:=sysdate;
end if;
end;
commit;
could anybody help me in this.No, the form is not fine else you would not have this FRM error message.
Check the syntax of the parameters given to the WebUtil_File_Transfer.Client_to_db() Webutil function. add a message() instruction just after to see if the function if well executed.
Francois -
How to find the name of the block and yours items at runtime
Hi, everybody.
I wonder if there is any way to list the name of a block and their respective items that forms at run time. for example, using a loop in wnfi.
Since already thank you.
Sorry for my bad English.Hi,
Try this code. It will travel through all block's items.
DECLARE
Str_First_Block VARCHAR2(100) := NULL;
Str_First_Item VARCHAR2(100) := NULL;
Str_Current_Block VARCHAR2(100) := NULL;
Str_Current_Item VARCHAR2(100) := NULL;
BEGIN
Str_First_Block := :SYSTEM.CURRENT_BLOCK;
LOOP
IF Str_Current_Block IS NULL THEN
Str_Current_Block := Str_First_Block;
END IF;
Str_First_Item := GET_BLOCK_PROPERTY(Str_Current_Block, FIRST_ITEM);
LOOP
IF Str_Current_Item IS NULL THEN
Str_Current_Item := Str_First_Item;
END IF;
MESSAGE('Item - ' || Str_Current_Block || '.' || Str_Current_Item);
PAUSE;
Str_Current_Item := GET_ITEM_PROPERTY(Str_Current_Block || '.' || Str_Current_Item, NEXTITEM);
EXIT WHEN Str_Current_Item IS NULL;
END LOOP;
Str_Current_Block := GET_BLOCK_PROPERTY(Str_Current_Block, NEXTBLOCK);
EXIT WHEN Str_Current_Block IS NULL;
END LOOP;
END;Regards,
Manu.
If my response or the response of another was helpful, please mark it accordingly -
Nested Tables and Forms 9i-please help
Hi
i have the folowing example of a nested table:
CREATE TYPE CourseList AS TABLE OF VARCHAR2(10) -- define TABLE type
CREATE TYPE Student AS OBJECT ( -- create object
id_num INTEGER(4),
name VARCHAR2(25),
address VARCHAR2(35),
status CHAR(2),
courses CourseList) -- declare nested table as attribute
CREATE TYPE Course AS OBJECT (
course_no NUMBER(4),
title VARCHAR2(35),
credits NUMBER(1));
CREATE TYPE CourseList AS TABLE OF Course;
CREATE TABLE department (name VARCHAR2(20),
director VARCHAR2(20),
office VARCHAR2(20),
courses CourseList)
NESTED TABLE courses STORE AS courses_tab;
In Forms i have created a data block based on table department and for managing the nested table courses_tab i found out that i should use a stored procedure:
PROCEDURE procedure_nest (c_c out courses_tab%rowtype) IS
c_c courselist;
BEGIN
select c.name, c.director,office into :department.name, :department.director,
:department.office from department c , table
(select n.courses from department n where c.name =n.name and rownum<=1);
END;
compil error:
error 999 at line 1, column 35
implemntation restriction (may be temporary) ADT or schema level
collection not supported at client side with non-OCI mode.
i really would like to know what shall i do to use and manage the nested table in forms.
Thank you very muchHi Francois. Thank you very much for your reply, but it seems that i still get errors. So let me tell what i have done.
As you suggested me: i have done a block based on a sub-query for the nested-table:
'select courses from department where name= :department.name'.
In the master block(department) i have the when-new-record-instance trigger:
Declare
LC$Req varchar2(256);
Begin
LC$Req := '(select ns.courses from table
( select courses from department where name = ''' || :DEPARTMENT.name || ''' ) ns )';
Go_block('block11');
Clear_Block ;
Set_Block_Property( 'block11', QUERY_DATA_SOURCE_NAME, LC$Req ) ;
Execute_query ;
End ;
Now the errors i receive, this time in the runtime mode are:
- FRM-41380: Cannot set the blocks query data source
-FRM-41003: This function cannot be performed here.
Since it seems that you know how to work with the nested table i would really appreaciate your help. I am new in the nested table and if you could give an ex with my tables it would be great.
Thank you in advance. -
Hi all,
I'm back again in Forms forum : ) !!! and I'm working on a new and very interesting project
version used : Forms [32 bits] Version 10.1.2.3.0 (Production)
A little question for gurus :
On former projects I used to call loops on blocks and item like shown below to do various things such as displaying buttons or showing canvas or different VA depending on the user or scenarios .
PROCEDURE FRM_BLK_ITM_LOOP IS
v_curblk varchar2(90); -- bloc courant
v_curitm varchar2(90); -- item courant
BEGIN
v_curblk := get_form_property(:SYSTEM.CURRENT_FORM,first_block); -- on récupère le 1er block de la form
LOOP
v_curitm := v_curblk||'.'||get_block_property(v_curblk,first_item); -- on récupère le 1er item du block
WHILE v_curitm != v_curblk||'.'||get_block_property(v_curblk,last_item)
LOOP -- tant que l'item n'est pas le dernier du block on loop
v_curitm := v_curblk||'.'||get_item_property(v_curitm,nextitem); -- on récupère l item suivant
if get_item_property(v_curitm,<some property>) = 'TRUE' then
--- I can do something.... or adding more conditions if then etc...
end if;
END LOOP;
EXIT WHEN v_curblk = get_form_property(:SYSTEM.CURRENT_FORM,last_block); -- on sort losrqu on arrive au dernier block
v_curblk := get_block_property(v_curblk, nextblock); -- on passe au block suivant
END LOOP;
END;In my current project we work on quite huge forms which can have a consequent number of blocks and items.
And we must be very careful regarding performance issues as these forms are accessed via LAN and WAN.
So my question :
This method seems to be quite efficient as it goes thrue blocks and items sequences as they are defined in the builder comparing to go_block -> go_item ->do_something which can easily turn into nightmare-programming.
But I don't really know about network roundtrips with this kind of method.
Is everything done in the app server and then fetched to the client?
What triggers block-level and item-level can be fired during the execution of the loop ? and so one...
Thanks in advance for your advices on this matter.
Jean-YvesHmmm, I have to say I never bothered if Forms is in Socket mode or not; I enabled the network statistics, counted the roundtrips and looked for ways to get them lower (my old friend wireshark did also a good job regarding this) ;). But regarding the note Forms 6i uses Socket Connections by default, this might apply to 10g too (or the enhancement request was approved, who knows).
Frankly I am not entirely sure what Socket Mode means; I guess it's the mode the forms applet talks to the forms runtime; wheter it's stateful (via Sockets) or stateless (via HTTP / HTTPS) but this is just a wild guess, and I can't find informations on it quickly. I also enabled networkStats on my Developer Suite only, so I cannot tell if you can enable them on a full-fledged Application Server.
Anyway; as said I just counted the roundtrips and looked where I can avoid them when I made our application ready for WAN.
Another useful tool was Shunra VE Desktop which I used to simulate low bandwith networks with high latencys; I installed it on a virtual XP, started the application and tested how the Application performs. If something looked odd, I looked behind the scenes, built a little testform basing on the code behind and tried out various things; very often you can take advantage of the event bundling forms seems to make when you use several set_xyz calls as Francois also noted; e.g.
set_custom_property('bean_item', 1, 'PROPERTY', prop);
set_custom_property('bean_item', 1, 'PROPERTY', prop);
set_custom_property('bean_item', 1, 'PROPERTY', prop);
set_custom_property('bean_item', 1, 'PROPERTY', prop);
set_custom_property('bean_item', 1, 'PROPERTY', prop);
vRet := get_custom_property('bean_item', 1, 'PROPERTY);most certainly will cause just 1 roundtrip; but if you use get_custom_property in the middle of the set_custom_property calls you will encounter 2 roundtrips as forms needs to synchronize (you get a value from the bean so the forms runtime needs a response) with the forms applet whereas set_custom_property is a one-way-street which can be fired off simultaneous. The same applies to fbean.invoke and fbean.invoke_bool, fbean.invoke_char and the like. Of course if you are using more then one get_custom_property in this case the roundtrips will increase accordingly.
If you want to make use of event bundling make sure you fire off as much set_xyz as you can before forcing forms to synchronize (e.g. with get_xyz, or synchronize, create_timer,...)
cheers -
hey guys,
what i am trying to do is to see how many recs are going to be retrieved and store that count in a variable upon execute_query. i have used the count_query built in right before my execute_query that i have in a when button pressed trigger,and i have a on_count trigger with the following code at the datablock level of that button
Declare
my_count varchar2(2);
Begin
my_count := get_block_property('my_block', Query_Hits);
set_alert('the count is'||my_count);
End;
For some reason when i execute the query it never fires that on_count trigger or gets inside it...any suggestions?
regards,
RobertRobert,
1 ) The trigger should be named as On-Count
and not on_count.
2 ) You should perform count_query; in the trigger
for it to function its default value.
Declare
my_count varchar2(3);
Begin
count_query;
my_count := get_block_property('emp', Query_Hits);
message('the count is'||my_count);
End;
Hope this helps.
Best Regards
Chandra Mohan -
Enabling and disabling the button in the multi record block
hi all,
i am using
Forms [32 Bit] Version 6.0.8.24.1 (Production)
Oracle Database 10g Release 10.2.0.1.0 - Production
i have a multi record block each block contains a button(button is to approve the record in terms of changing the status)
i have the items like date,remarks and button
the button should be enabled if the remarks is not null otherwise it should be disabled.
for this in pre-record trigger i have written
if :record is null then
set_item_property('button',enabled,property_false);
else
set_item_property('button',enabled,property_false);
end if;what problem is enable and disable is impacting on all the buttons in the block. in other words if first record's remarks is null then all the records button is disabled. if first record's remarks column is not null then all the records of the button column is enabled.
i have to make enable and disable the button for the corresponding record.that means if first record's remarks column is not null then only first records button should be enabled others should be disabled.
Thanks..You need to set the No. of items displayed to 1 as Ammad had said, additionally you can set the X and Y Position (Just Y will do and having fixed X) of the button depending upon the current record.
can u explain this part alone bit more (setting the position of x and y)You need to calculate the variable Y_POS depending upon the current position of the cursor that is the current record.
You can find the current record Y_POS using combination of
V_CURRENT_RECORD := :SYSTEM.CURSOR_RECORD;
V_TOP_RECORD := GET_BLOCK_PROPERTY ('BLOCK_NAME', TOP_RECORD);
V_ITEM_Y_POS := GET_ITEM_PROPERTY ('ITEM_NAME', Y_POS);
-- Also needs to add the Y_POS of the relative other items in the muti-record block
V_HEIGHT := GET_ITEM_PROPERTY ('BUTTON_NAME', HEIGHT);
-- Note :- TOP_RECORD Returns the record number of the topmost visible record in the given block.
V_Y_POS := V_ITEM_Y_POS + ((V_CURRENT_RECORD - V_TOP_RECORD) * V_HEIGHT);
-- You will need to add Distance between Items in records if anyThen you can Set the current Y_POS of the button.
SET_ITEM_PROPERTY ('BUTTON_NAME', Y_POS, V_Y_POS);
[/code[
Hope this helps
Best Regards
Arif Khadas
Edited by: Arif Khadas on Feb 24, 2011 4:58 PM -
"dynamic" get_block_property
Hi everybody,
I have a problem with a "dynamic" get_block_property.
The code is like that:
Declare
v_property varchar2(100) := 'INSERT_ALLOWED';
V_block varchar2(100) := 'BLOCK';
v_dummy varchar2(100);
Begin
v_dummy := get_block_property(v_block, v_property);
End;
This line returns an error "Numeric or value error" and I know this is because the property variable has to be a number value but I don't know if it does exist any conversion function or something like that.
Can anyone help me please?
PD: I work with Oracle Forms 6i.
Edited by: user12087557 on 08-jun-2010 15:54Hi,
So you have to write IF condition like,
DECLARE
v_property VARCHAR2(100) := 'INSERT_ALLOWED';
V_block VARCHAR2(100) := 'BLOCK';
v_dummy VARCHAR2(100);
BEGIN
IF v_property = 'INSERT_ALLOWED' THEN
v_dummy := GET_BLOCK_PROPERTY(v_block, INSERT_ALLOWED);
ELSIF v_property = 'UPDATE_ALLOWED' THEN
v_dummy := GET_BLOCK_PROPERTY(v_block, UPDATE_ALLOWED);
ELSIF v_property = 'DELETE_ALLOWED' THEN
v_dummy := GET_BLOCK_PROPERTY(v_block, DELETE_ALLOWED);
END IF;
END;Regards,
Manu.
Maybe you are looking for
-
We have a family iTunes account but we are now wanting to separate into 2accounts for financial reasons. Is it possible to transfere all purchased material into a new iTunes account then continue to have the 2seperate accounts with separate billing i
-
Can I copy my iTunes files and folders to Time Capsule wirelessly from my PC?
Can I copy my iTunes files and folders to Time Capsule wirelessly from my PC? I was wondering since my iTunes files and folders are connected to iTunes.
-
Need help in AP Invoice Workflow for Email Notifications
Hi, Kindly a Urgent help is needed in Oracle AP Invoice Worklfow There is existing functionality of Attribute Timeout Days for AP Invoice Notification is set as 3 So there is requirement after Timeout of 3 Days 3 Times Emails needs to be send.How to
-
Error when trying to post interest using FNM1 in Loan Module
Hi, I am getting error "50 E INTEREST EXP or ZBA CONTRA ACCT cannot be replaced' when positng the interest payment for loan in loan module. The system has posted a planned record and i see it in the cash flow however when posting the planned recor
-
I am not sure how to install my filters that are in PSE10 into PSE11
I have several filters that I bought and installed on PSE10. Can I install these in the PSE11? and how?