Non-Database items in enter-query mode
I have a form with 2 base table blocks, typical master details situation. I wish to allow a field from the detail block to be queryable from the master block. I was considering adding a non-database item to the master block (visible only when in Enter-Query mode). In a pre-query trigger I would amend the DEFAULT-WHERE property of the master block when the appropriate where clause using the non-database item value. My prototype/test version works fine except the non-database item is not enabled while the master block is in enter-query mode.
I think basically forms will enable only field s if they are database items and queryable set to yes. There are no more database items I can use to set the non-database item column name property.
Any suggestions would be appreciated.
Ralph
Oracle Developer - Unisys Australia
Hi Ralph,
we have several Forms using non-database items as query-items which works fine.
What we did is following:
1) create non-database item xy in master-data-block
2) set property database item to no
3) set property query allowed to yes
4) create a pre-query trigger on master-data-block where we change the where-clause (this is forms6i, in 9i we would use the one-time-where-clause)
Peter
Similar Messages
-
Including non database item in the query mode
Hi
I have a Master-Detail form. where in the detail block one of the field is text item 'X' attached the list of values(Y). Master block includes non database items which is based in the decoding result of the database items for example:
Gender(Male, Female)>> non database item
Gender_id(M,F)>>database item
the form is created based on the template.fmb form for apps. When I run the form in the query mode, i can query about any database item while including query about others non database item does not affect.
how to can i modify it so this could be handled??
thnx alotHi, it is probably best for you to post your question in the EBS forum
General EBS Discussion -
How to include non database item in the query
Hi
I have a Master-Detail form. where in the detail block one of the field is text item 'X' attached the list of values(Y). Master block includes non database items which is based in the decoding result of the database items for example:
Gender(Male, Female)>> non database item
Gender_id(M,F)>>database item
the form is created based on the template.fmb form for apps. When I run the form in the query mode, i can query about any database item while including query about others non database item does not affect.
how to can i modify it so this could be handled??
I know that one way to avoid this issue is to create a view with all my desired field.
but there should be away to override the build in query used by oracle apps...
any one has a link, source, document... etc that help on this??
any idea how to do it without creating a view??
thnx alotHi HST,
You can code the handling in POST-Query of the corresponding block to retrive the corresponding data depending on the Queried data.
Regards,
Kiran -
Disableing an item in enter query mode
Hello experts,
i want that a perticular item will be disabled after you press enter button of query menu.(or query->enter).Can any body please tell me what is the actual trigger in which i write the disable statement.
set_item_property('itemname', enabled, property_false);
Regards
AnutoshYou can't set the enabled property if the cursor is in the item and I expect it's the same for the query_allowed property. if the cursor is in the item which you set to Query_Allowed=false and then you go to enter-query mode, perhaps forms doesn't know what item to move the cursor to, so just leaves it where it is.
You can solve the problem by moving to a different item (with go_item) before setting the property.
When do you need to set the item back to enabled? If you want it enabled at all times other than when a query is being entered then use the Property Pallet to set the Query Allowed property. If you want to disable the field under certain conditions then the when-new-record-instance trigger might be better for you. Eg
if :system.mode = 'ENTER-QUERY' and <condition> then
go_item(<another item>);
set_item_property(<item>, enabled, property_false);
else
set_item_property(<item>, enabled, property_true);
set_item_property(<item>, update_allowed, property_true);
set_item_property(<item>, navigable, property_true);
set_item_property(<item>, update_null, property_true);
end if;It might be better to set the query_allowed property instead of the enabled property, but I can't check right now whether that's possible after the enter-query mode has begun.
The update_allowed, update_null and navigable properties are all set to false as a consequence of the enabled property being set to false. If they should be true then you need to reset them after reenabling the item. -
[ Forms10g2 ] Default item value in Enter-Query mode
Hello!
How could I specify default value for an item in Enter-Query mode? E.g. I press KEY-ENTQRY, and :L_YEAR item gots current year as a default search condition (though it may change). I've tried to implement it this way:
<pre>
Enter-Query;
:l_year := extract(year from sysdate);
</pre>
This work in a rather awkward way. If I run this once (e.g. as a result of a hotkey press), it just enters Enter-Query mode, but if I run this twice (by pressing hotkey second time) it fills :year variable and does search with it as a search condition! Then, I've tried to go straight and wrote:
<pre>
Enter-Query;
:l_year := extract(year from sysdate);
Enter-Query;
:l_year := extract(year from sysdate);
</pre>
Well, this didn't work. And SYNCRONIZE call before the second Enter-Query didn't help either. So, my questions are: 1) how can I achieve needed behaviour? 2) What's going on in my experiments? Why :L_YEAR gets assigned on second keypress (as in first experiment) but not on second subsequent call (as in second experiment)?
Thanks in advance!I don't know why that won't work but I have something which might:
when-new-record-instance trigger:
if :system.mode = 'ENTER-QUERY' then
:l_year := extract(year from sysdate);
end if;It's always best to use both the block and item names...:block.l_year -
Using Enter-Query Mode Programmatically
A question was raised in an earlier thread
QUERY CRITERIA MANAGER
about how to use Enter-Query mode programmatically in a way that doesn't stop
and prompt the user to enter a query after switching from Normal mode to Enter-Query mode.
Since the solution may not be widely known, I thought I'd demonstrate the technique here in a new thread.
Create a simple form with just two blocks. Using the data block wizard, create an EMP block with one
text item for ENAME. Place it on the canvas. Create the other block as a control block and name it CONTROL.
Inside the control block create the following items:
- create a text item named TXT_BOX
(The user will enter their search pattern criteria in this text box while in Normal mode.)
- create a push button item named EXECUTE_QUERY
(This button will switch to Enter-Query mode, execute the query, then return to Normal mode.)
Place both control items on the canvas.
Inside the WHEN-BUTTON-PRESSED trigger for the EXECUTE_QUERY button, enter the following code:
DECLARE
timer_id TIMER;
BEGIN
:GLOBAL.search_criteria := :CONTROL.TXT_BOX;
GO_BLOCK('EMP');
timer_id := CREATE_TIMER('ENT_QRY', 1500, NO_REPEAT);
-- 1500 may be a little long, but provides a margin of error
ENTER_QUERY;
END;
Next, create a WHEN-TIMER-EXPIRED trigger at the form level. Inside this trigger enter the following code:
If GET_APPLICATION_PROPERTY(TIMER_NAME) = 'ENT_QRY' THEN
:EMP.ENAME := :GLOBAL.search_criteria;
EXECUTE_QUERY;
IF :SYSTEM.MODE = 'ENTER-QUERY' THEN
EXIT_FORM; -- return to Normal mode
END IF;
END IF;
GO_ITEM('CONTROL.TXT_BOX');
Now, when the user runs the form and logs into the SCOTT schema, he enters a search criteria
such as A% in the TXT_BOX while in Normal mode. Then clicks the EXECUTE_QUERY button.
The form will switch to Enter-Query mode, retrieve all names in ENAME that begin with the letter A,
and then return to Normal mode without pausing for the user to enter a search criteria.
If the query should happen to fail, the form displays the error:
"FRM-40301: Query caused no records to be retrieved. Re-enter."
then switches automatically back to Normal mode so the user can try entering a new criteria.I'm showing how to do it when switching modes. I'm
not suggesting this is the best way to do a query.We need to look at this in the context of the original probelm in the thread linked to above. For most cases the when-timer-expired etc is just a huge detour around using the pre-query trigger but it's an interesting approach to the specific problem in the earlier thread. The OP there wanted to be able to type '>5000' into a number field in a non-database block, which we can do in a database block in enter-query mode, and use it as a query parameter in the database block. Perhaps if we enter this into a character field in the non-database block and populate the numeric field in the database block whilst in enter-query mode then we can do searches on ranges of data? Unfortunately it doesn't work - you get an ora-06502 error just like you do when using the pre-query trigger. For the situation in the original thread you would have to use a 'default where'. -
Initial Value in Enter Query Mode
Hi Everyone,
If you ever need to set a "visual" default (or initial) value for an item in Enter-Query mode, here is one solution to accomplish this:
Create a WHEN-NEW-ITEM-INSTANCE trigger at the block level where the item is located. Make sure it can fire in Enter-Query mode.
WHEN-NEW-ITEM-INSTANCE
If :system.mode = 'ENTER-QUERY' AND :system.cursor_item = <YourItemName> AND <YourItemName> IS NULL Then
<YourItemName> := <TheInitialValue>;
End If;You may wish to play with the "Keep Cursor Position" property of the item should you want the cursor to go back to the item position it was when the item was left.It seems that your solution described solves my problem expressed 2 months ago....
I'll try it out....
Thanks......
Sim -
Populate non database items with lov
Hi,
Let's say that I have one database block with 2 columns ID and NAME.
Only ID it is a not displayed database column, and NAME it is a displayed text item with an lov which retrieve data for both columns.
How can I do, to populate the non database item NAME after querying the block, without using POST-QUERY trigger and select into statement.
Thanks.Hi Gabriel
How can I do, to populate the non database item NAME after querying the block, without using POST-QUERY trigger and select into statement.u can't do that but with using POST-QUERY trigger and select into statement.
This Trigger fires the action of populating the non-db item block Level after executing query...
Regards,
Amatu Allah -
How to query non database items
hi every one
I have database block has database items and non database items
i want to make query in that non database items to retrieve data by that non database items and database items
thinksHi Every one
I want to use the non databsae item in query to retireve data by it
Example
In table emp
emp_id
emp_name
Dept_id
But in Form
Emp_name
Dept_name
When endtr data open lov to retireve Emp name and emp id
and when enter department name in table enter dept id but in form user see dept name in form .
but if he try to use dept name in query he can't because it non database item .
How can i use this item in my query to retireve data by dept name ? -
Querying a record from a non-database item
I am working in Apex 4.0. I have a page based on a table with the following columns: dktnr, borrower, amount, previous_dktnr, subsequent_dktnr. The precious_dktnr is the dktnr under which the loan was financed in the past, before its assumption or refiancing. The subsequent_dktnr is the dktnr under which the loan is later identified. When a loan is refinanced, it is assigned a new dktnr in a new record, and the old dktnr is placed in the previous_dktnr column of that new record, and the current dktnr is placed in the subsequent_dktnr column of the old dktnr record.
I created two buttons, one for the previous_dktnr and one of the subsequent_dktnr. When I click either of these buttons, the action redirects to the current page and places the value of either the previous or subsequent dktnr into the dktnr item. This queries the record for the dktnr that has the same value as the previous or subsequent dktnr.
This works. It allows the user to shuffle back and forth between the two dktnr's.
One would assume then that, if a non-database item were created, say :P22_QUERY_DKTNR, you would be able to enter an existing dktnr into that item and have a button, using the same logic as the previous and subsequent dktnr buttons, that would be able to return the record for the dktnr entered.
I have tried this, and it does not work. Can anyone tell me why it does not work?
Edited by: Doug on Apr 9, 2011 3:42 PM
Edited by: Doug on Apr 9, 2011 3:43 PM
Edited by: Doug on Apr 9, 2011 3:43 PM
Edited by: Doug on Apr 9, 2011 3:45 PM
Edited by: Doug on Apr 9, 2011 3:46 PMDoug,
Made copies of your two page within your workspace, page 3 & 4.
The issue was the page did not have a value in session containing your Look_Up value. I altered the Look-Up button to Submit the Page so as to capture the Look_Up value and then added a new Page Branch that was sequenced prior to your existing branch. This new branch sets your P4_DKTNR with the Look_Up value and then returns your results.
Jeff -
How to query on non database item?
I am working on AP Invoice form. The Invoice Header block based on table ap_invoices_all, I have database items such as invoice_num, invoice_date, and invoice_amount. I also have some non databases item like supplier and supplier number. I added POST_QUERY:
declare
supplier varchar2(240);
supplier_number varchar2(30);
supplier_site varchar2(15);
begin
select aps.vendor_name, aps.segment1
into :invoice_header.supplier, :invoice_header.supplier_number
from ap_suppliers aps
where aps.vendor_id = :invoice_header.vendor_id;
Also in PRE-QUERY
declare
supplier varchar2(240);
supplier_number varchar2(30);
supplier_site varchar2(15);
invoice_num varchar2(50);
invoice_date date;
invoice_amount number;
begin
select aia.invoice_num, aia.invoice_date, aia.invoice_amount
into :invoice_header.invoice_num, :invoice_header.invoice_date, :invoice_header.invoice_amount
from ap_invoices_all aia
where aia.vendor_id = (select vendor_id from ap_suppliers where vendor_name = :invoice_header.supplier);
It's showing fine with Suppier iformation I query by invoices, but I doesn't work when I query by supplier.
Can anyone help? I really appreciate.Hello,
Thanks for your reply. I think I need to clarify my problem
Your cursor has the same result as what I have in the post-query:
Select aps.vendor_name, aps.segment1
into :invoice_header.supplier, :invoice_header.supplier_number
from ap_suppliers aps
where aps.vendor_id = :invoice_header.vendor_id;
and they both work when I query on a database item, such as invoice_num and the non database item vendor name and vendor number will show up. I am doing ok with this.
My problem is when I query on vendor name field which is not a database item, such as CLARK PUBLIC UTILITIES, it will not return CLARK PUBLIC UTILITIES only, instead it returned all the suppliers. Could you please help with this? Thanks a lot. -
Query Non Database items in form
I need to be able to query non database items in the form.
Hi,
Yes you can do this. You have to create control items all of them have same data type and lenght as table's. then you can issue select statement. eg.,
select field1, field2
into :item1, :item2
from table_name;
Hope this helps
Mustafa -
Prevent interpretation of special characters in enter-query mode
My problem goes as follows:
- forms version: Forms [32 Bit] Version 6.0.8.10.3 (Production)
- non-database item block.X, char
- block.X is filled in post-query trigger. The post-query logic cannot be integrated in a view because it uses procedures, and usage of a pipelined function + view is currently not allowed due to "internal restrictions". Put simply: all logic to fill the field must remain in the post-query trigger
- user wants the field to be queryable. This is achieved by storing the entered criterium in a variable in the pre-query trigger, and using it in the post-query trigger to exclude records. E.g.
pre-query ==> help_block.query_X := block.X;
post-query ==> if help_block.query_X is not null and block.X is null or not block.X like help_block.query then raise form_trigger_failure; end if;
- this works fine for "regular" search strings. However:
- whenever the search string starts with <, <=, >, >=, !, forms seems to interpret the leading characters before doing anything else. During pre-query, block.X is null, and as soon as I use it in pl/sql, I get FRM-40831: Truncation Occured: value too long for field. E.g.
user puts the following in block.X ==> '<X', so he wants to search for records with value '<X' (text; not 'smaller than ...')
pre-query => msg.show(block.X) ==> appears to be empty/null, but right after the message, I get FRM-40831 Truncation Occured: value too long for field ...
This only happens if < is the first non-space character in the search string.
Does anyone know of a way to prevent oracle from interpreting the <, <=, ... characters entered in enter-query mode?I'm sorry for not making myself clear; I'll give it another go:
The problem is that, if I enter '<abc' in a form field in enter-query mode (so during creation of the "example record"), forms immediately interprets the < as 'smaller than' and does some obscure things with it (my guess: converting to a where clause, but since I'm using a non db field, this actually does nothing), and finishes by erasing the field contents (in the example record). In the pre-query trigger, I can no longer get the '<abc' and store it. I want one of the following:
- prevent forms from interpreting the '<' in front (same thing happens for !=, <=, >=, =, ...)
or
- capture the entered string ('<abc') before forms reacts to the '<' in front
Edited by: [email protected] on Feb 17, 2009 12:30 PM -
When-validate-record trigger only if a non database item is changed
Hi,
I am trying a code in the when-vaidate-record trigger in the BLOCK level.
The trigger should fire only if a checkbox item value is ticked(Value ='Y) for the present record(i.e, if already existing other records have a value ticked (='Y), it doesnt matter and trigger shouldnt fire)
Please help me achieve this :
The code I have tried in when-vaidate-trigger, which does not work as what I want :
DECLARE
X NUMBER;
BEGIN
if
nvl ( :DEFLOC.to_be_defaulted, 'N' ) = 'Y' and :DEFLOC.COMMENTS is NULL
and :SYSTEM.RECORD_STATUS ='CHANGED'
then
set_alert_property(
'err_alert',
alert_message_text,
'You must enter a comment when defaulting localities.');
x := show_alert('err_alert');
RAISE FORM_TRIGGER_FAILURE;
end if;
END;The above code does not fire at all..
If I remove the part,
and :SYSTEM.RECORD_STATUS ='CHANGED'
it fires for "all records"(not just the currently changed records) where nvl ( :DEFLOC.to_be_defaulted, 'N' ) = 'Y' and :DEFLOC.COMMENTS is NULL
Please help !!
Note: :DEFLOC.to_be_defaulted is a non database item ; :DEFLOC.COMMENTS is a database itemHi kriti,
There is one more way,
In the when-checkbox-changed trigger,
if :your_chk_box = 'Y' then
set_Record_property(:system.cursor_Record, 'your_blk',status,changed_Status);
else
set_Record_property(:system.cursor_Record, 'your_blk',status,Query_Status);
end if;
Then it is easy for you to find out the changed records using get_Record_property((:system.cursor_Record, 'your_blk',status)
Hey let me ask you one Question, is that check_box item is database item ???
If so,
it is easier..the fol. code will work for that
if nvl ( :DEFLOC.to_be_defaulted, 'N' ) = 'Y' and :DEFLOC.COMMENTS is NULL
and nvl(get_item_property('DEFLOC.to_be_defaulted',database_value),'N') = 'N' then
set_alert_property(
'err_alert',
alert_message_text,
'You must enter a comment when defaulting localities.');
x := show_alert('err_alert');
RAISE FORM_TRIGGER_FAILURE;
end if;otherwise
If your are creating that temp. item, it should be in the same block as non-db item.
I will explain this... You are setting the status of to_be_defaulted check box of some queried record to Y based on some conditions, right?
These records anyways are not updateable. Now your requirement is to find out the newly checked check boxes.
So in the post query or the place where you set to_be_defaulted as 'Y, we will default the new item with value Y, so that in the when validate trigger, you
know which record needs to attacked, It is those records with nvl( new item ,'N') = 'N' and to_be_defaulted = 'Y'...
Regards
Dora... -
Problem with non-database item
I have a 10g rel 2 form that has a post-query trigger that populates a non-database item. The non-database item has a when-validate-item trigger which I only want to fire when the user changes something in that field not at query time because it causes the form status to be changed. How can I either prevent this trigger from firing in query mode or test within the trigger that I'm in query mode so that the logic won't get executed?
Put this at the top of your when-validate trigger:
If :system.mode = 'QUERY' then
return;
End if;I have found that post-query activity often causes ALL when-validate triggers at the item and block level to run. So you may need those three lines in every when-validate trigger.
Maybe you are looking for
-
Copy files from mounted pc volume to mac
Hi all, I have a problem with the following script: var xmlfile = File.openDialog("Choose XML"); var result = File(xmlfile).copy("~/Desktop/" + xmlfile.name); This result is false (can't be copied) when the file is an a mounted PC Volume. (/Users/Pub
-
When I was given the iPod it had a GREAT load of songs already on it. (That was part of the whole "gift" thing.) I want to sync it and create playlists in my own library and copy the songs to my computer's library too. I applied for an Apple ID, an
-
I am facing a problem regarding a BDC for pa30 transaction ,for updating infotype 24. It is written through BSP application . When i create it's session through portal and run it through SM35 in the system ,It is perfectly working in 'forground' and
-
Fan Noise, Keychains, Phantom Computer ID
I have a 60 day old 2.16 Ghz MacBook with 2 G ram. When I migrated over from my old Cube, I started experiences problems with Keychain password requests. I have followed the directions for the fixes, but everytime I restart my laptop, it always asks
-
How to inform vendor for shortage of material during migo
In case of shotage in reciept that means during migo against PO in which PO quantity is 100 and u reciept 97 & 3 quantity having shortage in that case will any provision in migo transaction or any option through which we can send massge to vender reg