This content has been marked as final. Show 7 replies
You could use:
Where :block.item is the item populated by the LOV
Set_Block_Property( ..., DEFAULT_WHERE, 'table_column=:block.item'); execute_query;
This is how Forms works (if your block is based on a table):
- Go to enter query mode (depending on your key setting this is often F7 or by default F11).
- Go to your LOV item and open the LOV
- Select a value from the LOV. This value is shown in your field.
- Click on Execute Query.
within the "button pressed" i started the query with "enter_query" then the list values, then "excute_query", but that doesn't work properly. However, if i select the 'enter_query' from the menu bar, then my LOV, all works just fine. I don't want to have my customers to have to do this. I want the block to be in query mode, select from the LOV, then execute each and every time. suggestions?
here is my complete code on this button: when i press the button, it keeps asking me if i want to save it (if i say yes, it adds it to the table in the database, which i do not want). however, if i first select "enter query" from the menu bar, and then click on my button, everything works as expected.
--Set_Block_Property( 'SL_3_ITEMS_HEADER', DEFAULT_WHERE, 'parker.SL_3_SHORT_TITLE=:sl_3_short_title');
SL3 := :SL_3_ITEMS_HEADER.SL_3_SHORT_TITLE;
if SL3 is not null then
select SL_3_SHORT_TITLE into :SL_3_ITEMS_HEADER.SL_3_SHORT_TITLE
FROM parker.SL_3_ITEMS_HEADER WHERE SL_3_short_title = SL3;
message ('You need to specify an SL-3 to be able to search');
when no_data_found then
message('An SL-3 with that name does not exist.');
You have to set the block in enter query mode first. What you can do is create a when-new-block-instance trigger on your block:
It will probably never really work the way you want it. This works when you first open the form, but will not work when you click the button a 2nd time. This just does not work in a when-button-pressed:
IMHO, it's better to have users get to know how Forms works than trying to get Forms to work the way your users want it to work.
enter_query; list_values; execute_query;
There are workarounds with a search item in control block instead of the base table block, but is is just so much easier to use standard Forms functionality.
Thank you for all the suggestions, but below is how i actually got it to work. Created a new control block that was non-database related.
go_item('text_item60'); --control block, non-database related item.
list_values; LOV created from the database.
set_block_property ('SL_3_ITEMS_HEADER', DEFAULT_WHERE, 'SL_3_SHORT_TITLE like :BLOCK59.text_item60'); --copy from control_block into actual field to be used.
go_item('SL_3_SHORT_TITLE'); -- go to the actual field and execute. works everytime.
Edited by: 1002771 on May 6, 2013 11:27 AM
thank you everyone.