I'm trying to fill out various text fields on an apex application when I select a Reference Number in a select list.
When the page loads I'd like the text fields to be filled with the information from the database related to the reference number from the select list, however, I don't know how to do so. Any suggestions or help would be most appreciated!
As far as I understood the question:
user opens a page
there's a Select List item
user picks a value
you want to populate certain items on that page, based on a value user previously selected
If that's so, you'd use a dynamic action - create it on the Select List item, pick set value type.
[EDIT: How to do that?]
Scott's schema, DEPT table. Suppose that the select list item is P15_DEPTNO, while two other items are P15_LOC and P15_DNAME.
create a dynamic action on P15_DEPTNO
event: change
item: P15_DEPTNO
create its True action:
action: set value
type: SQL statement
select loc, dname
from dept
where deptno = :P15_DEPTNO
items to submit: P15_DEPTNO
affected elements: items P15_LOC, P15_DNAME
That's all.
Related
I have a form and I a dropdown pop-list with year values in it(year field is not a primary key).
I have to fill all other field values when i select a year from dropdown(need to execute query of data block).
how can i achieve this.
If that dropdown list is part of the data block (it doesn't matter whether it is or is not a primary key), then
navigate to that block
enter query mode
select year
execute query
If dropdown belongs to another (control?) block, then
in Forms Builder, open data block year field's property palette and set "Copy value from item" property to CTRL_BLOCK.YEAR
alternatively, create a data block-level pre-query trigger:
:data_block_name.year := :control_block.year;
create a button (in control block)
create a when-button-pressed trigger which will
go_block('data_block_name');
execute query;
run the form
select year
push the button
I have an entry with child data and here is check button with child items. If I check the items, then selected item should be printed - not all child items of this parent. How to do that?
The simplest option I can think of is to commit changes you've made (i.e. store checkbox values into the table).
Then call the report by passing the "master" row ID. Report's query would then look like this:
select some_columns
from master_table m join detail_table d on d.master_id = m.master_id
where m.master_id = :par_master_id
and d.checkbox = 1
The where condition would make sure that only checked rows are printed.
In order to "reset" it, you could use the "After Report" trigger and
update detail_table set
checkbox = 0
where master_id = :par_master_id
However, this won't work in multi-user environment as many users could work with same data and "overwrite" each other's checkboxes. Better option would be to create additional table and store [user, master_id, detail_id] rows so that everyone uses their own values.
Or, while in form, if there aren't too many child records, use a loop to concatenate IDs of checked rows and pass them to the report which would split that string into rows.
I have a drop down select list (P2_ROLE). I want to generate the interactive grid based on the value that I select from the drop down.
I am trying to do that but the query is not returning any result in the grid. However, if I query it in the database, it returns me the result.
It looks like that it is not substituting the value from the dropdown into the IG query. But If I hard code the value, it gives me the results.
dropdown_IG issue
I also tried returning the value selected from the dropdown in the item : P2_SELECT_LIST_VALUE and then using it in the query. But it also doesn't work.
The query that I have used for my Interactive grid is :
Select USER_NAME
From WF_USER_ROLES
Where ROLE_NAME = :P2_SELECT_LIST_VALUE ; --using the value from new item
or
Select USER_NAME
From WF_USER_ROLES
Where ROLE_NAME = :P2_ROLE; -- using the value directly from Dropdown
After selecting the value in the dropdown, I am refreshing the IG region using dynamic action on change select list. But that also doesn't help. How can I do that ?
Select list returns two values: display and return. Its form is, for example,
select dname disp_val,
deptno ret_val
from dept;
Its return value is then used in interactive grid's query.
Also, in order to be able to use select list's value, it has to be stored in session state; if it is not, query won't work. The simplest option is to submit the page, and you can do that by setting that item's Page action on selection property to "Submit page". Doing so, your IG query:
Select USER_NAME
From WF_USER_ROLES
Where ROLE_NAME = :P2_ROLE
should work OK. If it still does not, create an example on apex.oracle.com, provide credentials so that we could have a look at what you did.
I have two cascading LOVs. After changing value of my first LOV in second LOV appropriate values are populated.
First LOV:
name - P2_DEPTNO
select dname, deptno
from dept
order by 1;
Second LOV:
name - P2_EMPNO
select ename, empno
from emp
where deptno = :P2_DEPTNO;
cascading LOV parent - P2_DEPTNO
What should I add to set default value of second LOV (first row from query) after changing first LOV value?
Make sure you have Display Null Value set to No and it should use the first value in the list. (Although I am not sure what it will do with Popup LOV).
Finally, I got the correct answer on the Oracle community forum.
This is possible in only one case, because I'm more familiar with this type of issue in my project.
We need to change the second item type i,e "Empno" item type from Pop-up LOV to Select-List.
Also make null setting changes as per given below :
On DEMO works proper.
Please note that this will CAN NOT be achieved with item type as POP-UP LOV directly using simple step. To make this work using you need to work on POP-UP LOV we need so much custom changes, like DYnamic Actions , JS Code, Asynchronous calls to DB.
Source - https://community.oracle.com/thread/4048009
Author - EnigmaCoder
The first problem is that I have a button. I created a process called nextweek( to get data for next week from reservation table). I tried this The PL/SQL only as a trial:
begin
if :RESERVNO is null then
select RESERVNO
into :RESERVNO
from reservation;
end if;
end;
but the page keeps telling me "NO DATA FOUND". I would like to create a report with the result of my PL/SQL Query
My second problem is that I want to take values from a textfield and use it in my PL/SQL Query in another button as the "ACCEPT" in oracle.
As I understand, you need following:
Create report: click Create new page button (or create region if you already have a page), then choose region type Report. Write your source SQL query in the field Region source (choose Source type - SQL Query).
Create an item (textfield). For example, with the name P_MY_ITEM
Create a button. Here you don't need to change default properties. (Action on button click should be Submit page)
Add this item name to the source query in the region. It should look like:
select column1, column2, column3
from table1, table2, table3
where column4 = :P_MY_ITEM
and <other conditions>
After that, user can write something to the input field and press the button, page will be reloaded, and report will be changed accordingly to the item value.