I need to run a query with a value that is selected from a LOV.

I've got the next setup :

  • a block named "MENIU"
  • a table named "MENIU" with a column "ID_MENIU".
  • a LOV named "LOV_MENIURI"
  • a parameter named P_IDMENIU
  • a button on the form named "Alegeti Meniul"

In order to run a query with the value selected from the LOV I've tried this :

  • LOV return item "ID_MENIU" is set to PARAMETER.P_IDMENIU
  • in the pre-query of block MENIU I've assigned the PARAMETER.P_IDMENIU value to MENIU.ID_MENIU
  • Button "Alegeti Meniul" has the next "when-button-pressed" trigger code :

    declare 
        success boolean;
    begin
    Enter_Query;
    success := show_lov('LOV_MENIURI');
    Execute_Query;
    end;
    

My problem is that when pressing the button for the first time nothing happens, if I press the button a second time LOV window appears and the query is executed twice.

A GIF with the outcome:

有帮助吗?

解决方案

You don't need that enter_query call.

begin 
  if show_lov('LOV_MENIURI') then
    execute_query;
  end if; 
end;

When calling the execute_query built-in you'll fire the pre-query trigger, setting the where clause using the value returned by the LOV.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top