SET_BLOCK_PROPERTY
Hi,
I'm trying to set where caluse dynamically, but it is giving me error.
SET_BLOCK_PROPERTY ('emp', DEFAULT_WHERE, 'where deptno in ||'''('''select deptno from dept''')'');
How to set the "(" in the where caluse ?
Thanks in advance.
It is like this
l_where := 'where deptno in (select deptno from dept)';
set_block_property('emp',default_where,l_where);
Thanks
Similar Messages
-
How can I display records quickly in order, using set_block_property
Hi all,
I want to display records in order when I click on button corresponding to that filed.I'm getting result by using set_block_property..but it is displaying records slowly,if number of records are more then it's taking more time to sort the records.
I have written the following code in when-button-pressed trigger:
begin
if get_block_property('block_name',default_where) = 'column_name ASC' then
set_block_property('block_name', default_where,'column_name DESC');
else
set_block_property('block_name',default_where, 'column_name ASC');
end if;
end;
How can I get the result quickly can anyone please give me an idea to solve this.
Thanks in advance.Hi user;
I want to display records in order when I click on button corresponding to that filed.I'm getting result by using set_block_property..but it is displaying records slowly,if number of records are more then it's taking more time to sort the records.
I have written the following code in when-button-pressed trigger:
begin
if get_block_property('block_name',default_where) = 'column_name ASC' then
set_block_property('block_name', default_where,'column_name DESC');
else
set_block_property('block_name',default_where, 'column_name ASC');
end if;
end;
How can I get the result quickly can anyone please give me an idea to solve this.Did you try to use index for related column? Also did you try to use order_by instead of default_where
If its not help, I also suggest post your issue on :Forum Home » Developer Tools » Forms
Hope it helps
Regard
Helios -
Set_block_property with Like and Between and function
Hellow All
I need to find out record where Column Name between
:Text_item1 and :Text_item2 with Default_where
For example Manu guide me to find out record with
SET_BLOCK_PROPERTY('Block53', DEFAULT_WHERE, 'name like ''' || :block70.text || '%''');
go_block('block53');
EXECUTE_QUERY;
Now i need
To find our Record where name between :block70.Text1 and :Block70.text2 with Like Function
For example
I have one Column :NAME
I want to find out record in name Column with Default Where option where name between Text1 and Text2
I Hope you guys understand my requirement
Regards
Shahzaib ismailHai,
Try
SET_BLOCK_PROPERTY('BLOCK53', DEFAULT_WHERE, 'NAME BETWEEN ''' || :BLOCK70.TEXT1 || ''' AND ''' || :BLOCK70.TEXT2 || '''');
GO_BLOCK('BLOCK53');
EXECUTE_QUERY;and when you are using BETWEEN for character fields, then LIKE will be there.
Example, your NAME field have,
1) Abcde
2) Asdf
3) Awer
And if your condition is NAME BETWEEN 'A' AND 'Z' then you will get all daya.
And if your condition is NAME BETWEEN 'Ad' AND 'Z' then you will get 2 and 3. like that.
Regards,
Manu.
If this answer is helpful or correct, please mark it. Thanks. -
Set_block_property and Default_where
Hi All,
I'm trying to set the default clause at runtime,for that i'm using set_block_properties.
Here is my cde:
Set_block_property('RECIPIENT_VIEW',DEFAULT_WHERE,'RECIPIENT_NAME LIKE '||''''||:RECIPIENT_NAME ||'%'||'''');
I'm NOT getting if i use this in KEY-EXEQRY or PRE-QUERY triggers(I'm getting it, when i use this in button).
How can solve this problem in KEY-EXEQRY or PRE-QUERY triggers ?
Please help me.
Thanks
PBecause form default enter-query, execute-query buttons look your input format:
1) if you type in A in the field, then form constructs the default where by appending additional RECIPIENT_NAME ='A';
2) If you type in A% in the field, then form constructs it by appending the additional RECIPIENT_NAME LIKE 'A%';
That's to say, if you SET_BLOCK_PROPERTY('blockname',
DEFAULT_WHERE,
'RECIPIENT_NAME LIKE '''||:RECIPIENT_NAME ||'%'||''') in the PRE-QUERY trigger of forms6i, then the block where condition becomes the below format,
for 1) input:
RECIPIENT_NAME LIKE 'A%' AND RECIPIENT_NAME ='A'
for 2) input:
RECIPIENT_NAME LIKE 'A%' AND RECIPIENT_NAME ='A%'
Therefore, for input 'A%' it will work for you, for input 'A', it will have no much chance to get the record unless you make record 'A', then it will get you the data.
Remember, after you type in something, the block where clause changed if you use the default menu enter/execute-query buttons.
you will see it if you check the :system.last_query. -
db and dev 10g rel2 ,
i am trying to learn about this built-in with variables and the equal(=) operator , i can not use it with variables , so show me please how to use it with number , charachter and date variables .
1- working with number variables .
- i have the block 'scott.emp' , and a button 'search' .
- my variable 'v' holds the value 7788 , and i want to display the data based on this number of the 'empno' column .
how to do it with set_block_property ?
thanks in advance
Edited by: newbi_egy on Apr 5, 2013 3:11 PM
Edited by: newbi_egy on Apr 6, 2013 2:55 PMnewbi_egy wrote:
this is so correct HamidHelal , but what i want to ask about is ,
i know that the part after "default_where" of the set_block_property built-in should reside between two single quotes like so
set_block_property('emp',default_where,' ') ;
but your letters does not reside between these single quotes ' ' , what resides is just this ('empno=') , and if the whole sentence should reside between single quotes , it should be like so
('''empno='||v'') as the two quotes at the beginning of the sentence and at the end are in fact one quote (one at the beginning and one at the end . -- these are which enclude the whole sentence which is ('empno=') .should not it work like so ? -- sure it is not working , but i want to understand why is not it working ? Ok. working statement is
SET_BLOCK_PROPERTY('emp', DEFAULT_WHERE, 'empno = '|| V);where 'empno = ' is fixed string. variable value of V is concatenate.
Following statement also work. and meets set_block_property('emp',default_where,' ') ;
SET_BLOCK_PROPERTY('emp', DEFAULT_WHERE, 'empno =7788 ');What is the difference ?
Difference is, in the first statement we set the empno value dynamically where second one is fixed.
Hope it's clear..
Hamid -
I want to use a variable in set_block_property
i m trying to SET insert_allowed,update_allowed property of database at form level.
SET_BLOCK_PROPERTY(ARG_TBL_NAME,UPDATE_ALLOWED,PROPERTY_TRUE);
Its working fine with above syntax but i want to do like this can I?
SET_BLOCK_PROPERTY(ARG_TBL_NAME,UPDATE_ALLOWED,X);
-- WHERE X IS ANY VARIABLE WHICH CONTAIN VALUES EITHER PROPERTY_TRUE OR PROPERTY_FALSE.
WHEN I TRIED THIS MY FORM COMPLIED BUT AT RUN TIME WHEN IT COMES THIS STATEMENT IT JUST SIMPLY CLOSED. REMBER I M USING FORM 6IOk, here's the deal. PROPERTY_TRUE and PROPERTY_FALSE are Forms NUMERIC Constant variables. The numeric value for these variables are:
PROPERTY_TRUE = 4
PROPERTY_FALSE = 5
You can find the value of almost all Forms Constant variables by simply outputting them to the message console using the Message() built-in, eg; Message(PROPERTY_TRUE);
If you want to make this parameter to Set_Block_Property more dynamic, then I would make "X" a numeric variable and where ever you are assigning "X" a value either assign it the literal value or use the Forms variable. For example:
BEGIN
IF ( SOME CONDITION is TRUE ) THEN
X := 4;
ELSE
X := 5;
END IF;
END;Or you can use the following:
BEGIN
IF ( SOME CONDITION is TRUE ) THEN
X := PROPERTY_TRUE;
ELSE
X := PROPERTY_FALSE;
END IF;
END;Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
Set_block_property does not called the query from the where clause
Hi all,
I have two blocks in the Oracle form 6i. Master link with the detail. Because of the data is quite huge if I have the auto query when the form is loaded hence I have two enter parameter created of From_date and To_date together with button to execute the query when that two parameter is being filled.
I have the following quotes in the button of when-button-pressed :-
BEGIN
set_block_property('act_vw_sale_comm', default_where, 'invh_dt >='''|| to_date(:act_vw_sale_comm.fdate,'dd/mm/yyyy') ||''' and invh_dt <= ''' || to_date(:act_vw_sale_comm.tdate,'dd/mm/yyyy')||'');
go_block('act_vw_sale_comm');
execute_query;
set_block_property('act_vw_sale_comm', default_where, '');
END;
However, nothing being displayed when I click on the button. Anything wrong on the above statement ? Please help me. thanks.
Rgds
LimBEGIN
go_block('act_vw_sale_comm');
set_block_property('act_vw_sale_comm', default_where, 'invh_dt >= '''|| :FDATE ||''''' AND invh_dt <= '''|| :TDATE ||'''');
execute_query;
--set_block_property('act_vw_sale_comm', default_where, '');
END;
Now, I have the above statement, but still the same when try to execute the query, this time, the screen execute but does not show anything and close my form straight away. Why!
Anyone can help me?
Thanks
Lim -
Order_by in set_block_property returns ORA-01785
Hello.
We have a problem with using function in set_block_property with order by when using union sentence.
Our code looks like:
set_block_property('block', default_where, 'id = '||:item||'
UNION ALL
SELECT ROWID,column1,column2,column3,... FROM table WHERE
id = '||:item);
set_block_property('block', order_by, 'function(column1), column2');
Form returns error: ORA -01785 : ORDER BY item must be the number of a SELECT-list expression
We know, that with union we should use numbers in order by instead of column names. But it doesn't work.
If we do not use UNION, then order_by with function works.
How can we solve this problem?
Thanks.
Edited by: DejanH on Sep 10, 2008 8:03 AMNot sure you can ever get Forms to handle that complicated a query using default block processing.
Since it looks like your block is display-only, I would create a record group with the query and order by, populate it, and then step through the record group row-by-row moving the values to the block (which would then be a control-block rather than a base-table block). Of course, if your query selects more than a few hundred rows, this is not a good solution. -
Use system.cursor_block in default_where of set_block_property
Dear All.
I have got a control_block with Search&update button.I have got 3 database blocks.I wish to use above button for searching all the blocks by dymanically passing the block name using system.cursor_block:
go_block('SYSTEM.CURSOR_BLOCK');
set_block_property('SYSTEM.CURSOR_BLOCK',default_where,'CONTROL_NO='||:SYSTEM.CURSOR_BLOCk.CONTROL_NO);
execute_query;
set_block_property('SYSTEM.CURSOR_BLOCK',default_where,'');
above code is giving error at :syste..cursor_block.control_no.
Plz. help me how to do this.
Thanks in advance.
Manitry this statement
go_block(:system.cursor_block);
set_block_property(:system.cursor_block,etc etc);
execute_query;
set_block_property(:system.cursor_block,default_where,'');
Hope it helps you,
Fabrizio -
Pre-query set_block_property Default Where
I need some information regarding
SET_BLOCK_PROPERTY , DEFAULT_WHERE
How it works
I am using this code
SET_BLOCK_PROPERTY('bank_recon',
DEFAULT_WHERE, 'v_bankcode= ''' || :button.bankcode || ''' and ' || 'v_chq= ''' || :button.chq_no ||
''''); but when I add one another condition not work
SET_BLOCK_PROPERTY('bank_recon',
DEFAULT_WHERE, 'v_bankcode= ''' || :button.bankcode || ''' and ' || 'v_chq= ''' || :button.chq_no ||
''' and ' || 'recon is null'||
''''); Please guide me and inform me how it is work... how to use its *' '*try
DECLARE
v_sql VARCHAR2(300);
BEGIN
v_sql := 'v_bankcode= ' || '''' || :button.bankcode || '''' || ' and v_chq= ' || :button.chq_no || ' and recon is null';
SET_BLOCK_PROPERTY('bank_recon', DEFAULT_WHERE, v_sql);
END;if you have doubt about the syntax, you can check it by showing a message like
message('sql=' || v_sql);PAUSE; -
Set_block_property(' ',default_where,' ') built-in
db and dev 10g rel2 , xp
hi all,
if anyone could demonstrate this built-in to me , when using it with number and charachter or date text_fields ,
specially with (= and like) operators .
because i have a problem with using quotes with it . i do not know the roles for using quotes with it .
for in stance , i have the table emp , and two text items , one to execute the query on the block by the deptno column , and the other with date or charachter column like hiredate or ename , i think the two are the same .
if you could give me an example and demonstrate it please .
thanks in advanceIf you are using forms items/parameters you can actually use them in the default where like bind variables and not care about quotes at all. Let's say you have a block with one number, one date and one char item (all non-basetable). You'd simply could
set_block_property('basetable_block', default_where, 'where num_col = :blk.num_item or char_col = :blk.char_item or date_col = :blk.date_item');as you can see no quote escaping no matter of the data type.
It get's a little bit harder when you are using PL/SQL variables as you cannot bind them like you can with items or parameters
set_block_property('basetable_block', default_where, 'where num_col = '||num_val||' or char_col = '''||char_val||'''');it get's worse with dates:
set_block_property('basetable_block', default_where, 'where date_col = to_date('''||to_char(date_val,'dd.mm.yyyy')||''',''dd.mm.yyyy'')');To demonstrate how escaping actually works we'll translate the where clauses the way they get sent to the database; assuming num_val has a value of 3, char_val has a value 'ABCD' and date_val has a value of 01.01.2013.
where num_col = '||num_val|| or char_col = '''||char_val||'''would be
where num_col = 3 or char_col = 'ABCD'
where date_col = to_date('''||to_char(date_val,'dd.mm.yyyy')||''',''dd.mm.yyyy'')would be
where date_col = to_date('01.01.2013','dd.mm.yyyy')If in doubt with escaping simply output the string to e.g. a file, and when it contains valid SQL you did everything right with the escaping.
cheers
EDIT: this is actually pen-and-paper writing of code; I didn't compile anything of the above so it might be that some of the ' are missing, but I guess you should get the point.
Edited by: christian erlinger on 27.02.2013 05:25 -
Set_block_property default_where problem
Dear proffessionals,
during setting the set_block_property value for database block i'm facing next problem:
1. Query select cr_pjid from acc_users where username='ACCBTPS121' give result
CR_PJID
'26','63'2. Query select * from acc_accbtp_nova_view where ed_id=2 and to_char(pj_id) in ('26','63'); return 186 rows.
3. Query: select * from acc_accbtp_nova_view where ed_id=2 and
to_char(pj_id) in (select cr_pjid
from acc_users
where username='ACCBTPS121'); doesn't return any row... :(
So, set_block_property('acc_accbtp_nova_view',default_where,'ed_id = '||':global.org_dio_id and to_char(pj_id) in (select to_char(cr_pjid) from acc_users where username=user)'); doesn't work...
Could anyone help me ?
Thx in advance,
Adnan
Edited by: adnanBIH on Nov 20, 2010 10:25 AMand like this?
DECLARE
vStr acc_users.cr_pjid%TYPE;
BEGIN
SELECT cr_pjid
INTO vStr
FROM acc_users
WHERE username=user;
SET_BLOCK_PROPERTY('acc_accbtp_nova_view',DEFAULT_WHERE,'ed_id = :global.org_dio_id and to_char(pj_id) in ('||vStr||')');
END;-Ammad -
Set_Block_Property invoke has caused the earlier enter value get disappear
Hi all,
I got a simple field which set to let user to enter a value and from the entered value user will need to press the button to search for the next display value. I have set when_button_pressed with set_block_property
go_block('ot_mat_iss_head');
Set_Block_Property('OT_MAT_ISS_HEAD', default_WHERE, 'MIH_NO = '''|| :OT_MAT_ISS_HEAD.MIH_NO1 ||''' ');
go_block('OT_MAT_ISS_HEAD');
execute_query;
the above query work fine where I got the next field display with value that what I want. However, the first column that ask user to enter the value was get disappeared. How come ? How to get it display in this case ?
Thanks.
Regards,
LimThe first column where I ask user to enter value was in the same block with the second column that display the value. Immediately, the second value get display the first value get disappeared after press on the button.This is expected. Because your non-base table item is part of the block you are querying, when you call EXECUTE_QUERY, it clears the block (including any non-base table items) and queries the selected record.
If you want the search value to continue to be displayed in your non-base table item, then move the non-base table item to a Control block (non-base table block). Then the EXECUTE_QUERY will not affect the value of the item.
OT_MAT_ISS_HEAD.MIH_NO1 is a non db field. If I changed to DB field when I execute the button, system will prompt to ask me whether want to save my record.Again, this is expected because Forms recognizes that you have changed a record displayed in your table. Therefore, Forms will ask you if you want to save your changes. If you want to continue to display the searched value in your non-base table item, move it to a Control block.
Craig... -
Re Set Set_Block_Property DEFAULT_WHERE value
I have a Tabular form which have the invoice details with below two Buttons
BTN_QUERY (WHEN-BUTTON_PRESSED) TRIGGER
go_block('BLFRT');
execute_query;BTN_UNRECEIPT (WHEN-BUTTON_PRESSED) TRIGGER
if :system.mode like 'NORMAL' then
go_block('BLFRT');
Set_Block_Property('BLFRT',DEFAULT_WHERE,' BL_REC_FLAG IS NULL');
execute_query;
end if;As soon i click BTN_QUERY i get the data in the grid and also when i click BTN_UNRECEIPT also works fine.
the problem is after clicking BTN_UNRECEIPT if i click BTN_QUERY it shows the filtered records and not all the records. i can understand it's because the value is set with BL_REC_FLAG IS NULL. how to clear this and show all records IN BLFRT when i click BTN_QUERYHi,
Try to use PRE-QUERY trigger and use
Set_Block_Property('BLFRT',DEFAULT_WHERE,' BL_REC_FLAG IS NULL');
on conditional bases
Regards,
Uzair Hasan Nizami -
declare
where_string varchar2(200):= 'COP_CODE = :GLOBAL.COP_ORDER_CODE' ;
REC_PRE NUMBER;
BEGIN
SELECT COUNT(*) INTO REC_PRE FROM IM_NEW_ITEMS
WHERE COP_CODE = :GLOBAL.COP_ORDER_CODE ;
if NVL(REC_PRE,0) != 0 then
set_block_property('IM_NEW_ITEMS',default_where,where_string) ;
go_block('IM_NEW_ITEMS');
execute_query;
LAST_RECORD;
set_block_property('IM_NEW_ITEMS',default_where,'') ;
NEXT_RECORD;
SHOW_MESSAGE(':SYSTEM.RECORD_STATUS'||' '||:SYSTEM.RECORD_STATUS);
:IM_NEW_ITEMS.ITEM_CLASS := :GLOBAL.CLASS_CODE;
REC_PRE := 0;
end if;
end ;
my problem is appear when I want to insert a new record it does not insert
the new record in the current form.
So how to change the set_block_property to the insert mode , so that the records
will be inserted in the in the current form.
Best regards
Jamil AlshaibaniHi
No I do not want to insert the same set of record after populating data from the same table,
I am using the following script
LAST_RECORD;
set_block_property('IM_NEW_ITEMS',default_where,'') ;
NEXT_RECORD;
To create a new record, so what I want to insert is the new created record only,not the retrieved records.
Thank a lot for your cooperation .
Best regards
Jamil
Maybe you are looking for
-
Hi All, We have a report with two dimensions in col , one in row remaining in pov...user want to select multiple members [its more than 10 members..so we thought prompts will not be good.] for one column for different members in second dimension of c
-
Embed Adobe Reader in custom Android (or PhoneGap) Application
We have a need to embed PDF reader in one of our custom built Android (or PhoneGap Plugins) tablet application. Embed meaning is not just display pdf document inside the application instead we have to tap the following API functionalities programmati
-
Memory leak with variant/OCX
I'm trying to get images from an IP webcam thanks to an ActiveX and process them with IMAQ. This ActiveX needs a variant to put chars from the image. It seems to work fine, (nearly 'in real-time') when I convert a string into a variant. Nevertheless,
-
Problem Clearing a hierarchical tree
Is there a better way to clear a tree without deleting all the nodes. I want to clear the tree and not display anything.
-
How to read ssas cube and role from Excel vba
Hi, I want to read all roles and cubes in SSAS Db from Excel Vba. 1. First i want to read all the roles which was assigned to me 2. based on the role, i have to read all cube name Please help me to accomplish this task.