How to enable interactive grid cell validation in Oracle Apex Master-Detail page? - oracle

I have created a Master-Detail page in my Oracle APEX application. Basically i have a list of rows from one table and I can add values to it though a form. That works correctly, validations also work (every column from Master form can be accessed by adding ":" in front and that works in this case). I also have an option to edit click pencil icon in front of every row which lets me to update current row and also displays the Detail part of that row. Detail part is a list of values from another table that is connected to the first one using foreign key (Master-Detail: one to many). It is automatically displayed as interactive grid, so when editing my Master table value I can also add new rows to Detail table, but the validations don't work for Detail table. I tried accessing it's columns the same way as before, but it just doesn't work (tried to add PL/SQL expression validation:
:column >= 0
but that didn't work. How can I enable the validation for interactive grid, because I've looked into some resources about it, but they just show the first way, that doesn't work for me?

For a validation on an Interactive Grid you need to set the attribute "Editable Region" for the validation to your interactive grid. That works ok for me. I tried with a Master Detail on Dept (Master) and Emp (Detail) with a validation on detail of :SAL > 1000

Related

Modal Dialog Form Primary Key item not refreshing in Parent Page

I am beginner in Oracle APEX (Version 22.11) and I hope, that someone can help me:
I have an Interactive Report as Parent Page. I get the data with a (simple) sql query. There is also a Create-Button, which works fine. It opens an empty Modal Dialog Form, where I can fill in the entries. There is a dynamic action, which refresh this Interactive Report by Closing Dialog.
On another page I have this Modal Dialog Form, which use the same sql query as the Parent Page and have the four button 'Cancel','Delete','Save' and 'Create'. I choose also a primary key and do different setting:
under 'Processing' I make Form - Automatic Row Processing(DML) and also Yes to 'Return Primary Key(s) after Insert
for the 'Save'-Button I have the following Behavior:
Action: Submit Page
Database Action: SQL UPDATE action
Also I have for this button the following Server-side Condition:
Type: Item is NOT NULL
Item: [Item of the primary key]
Now, I have the following problem with this Save-Button (the other buttons works fine): When I edit the Radio Button or the Textfield in this Modal Dialog Form and click the Save-Button, the Parent Page takes over the changes. But when I change the Textfield of the primary key Item or when I change another Textfield or a Radio Button together with this Primary-Key-Textfield, the Parent Page doesn't take over the changes.
Where is the mistake? Can anyone help me?
I think what happens is something else than what you think is happening. As a test I created an interactive report with a form on the EMP sample table (you can generate that in SQL Workshop > Utilities > Sample Datasets). Out of the box the report refreshes when a change in the modal form is submitted. In the modal form P102_EMPNO is marked as primary key.
No what does that mean ? It means that that page item is used by the apex engine to uniquely define the row when executing dml (update/delete) on that row.
I changed the page item P103_EMPNO to a text field, enabled debug and submitted the form. This is what debug shows:
As you can see, the where clause of the update statement is:
where "EMPNO"=:APEX$PK1
I'm assuming the bind variable :APEX$PK1 is what the apex engine has decided is the bind variable for the (first) primary key column in the form.
So... if you change the primary key, then it is NOT going to update the primary key for that row. Instead it is going to try to update a row that has the newly entered primary key value. And the refresh you're expecting is not happening... because no rows were updated.
The reason is that primary keys should never be changed during normal operation in a relational database. They uniquely define the rows - that is what a primary key does. The form region is based on this principle and the behaviour that you're seeing is expected. Also, the reason that the primary key page item is hidden or display only when a form is created is that a primary shouldn't be changed.
Now if you really want to change the primary key value (my advice: DONT. EVER.) then you can probably create a form yourself and use the rowid to identify the row. Out of the box the form region does not let you select the row id.

Oracle Apex - Interactive Grid rows values are repeating in other rows by clicking

I'm having this issue in Oracle Apex where I want to create a Master/Detail page with interactive grids for each section. The problem is that for some reason, when I click to edit rows in the detail grid, the values seem to "copy" into other fields too.
This is my grid when the values get copied when clicked in other row
For the master grid, this doesn't seem to happen.
Silvio.
I had the exact same problem.
I found myself that i defined the wrong column as primary key on the detail IG.
Try it and let me know if helped.
Have a nice day.

Oracle ADF : Select Check box at row level giving issue while selecting in panel tabbed

I am referring to this blog.
http://andrejusb.blogspot.in/2010/05/yes-no-check-box-in-query-criteria.html
however my requirement is different. I have multiple tabs where multiple tables are present. In each table row I need a column attribute is_active in checkbox format. So basically I want to store active or non active setup lines through panel tabbed screens.
With above blog approach first tab is working fine for checkboxes, but the second , third and other tabs are having below issues in check box.
When selected one checkbox, let's say it is checked, other checkboxes in all rows gets checked.
I checked the binding it is bind to it's respective attributes and VO iterators in pagedefinition, I chceked the code for model and view layer for working and non working tab.
Above issue is solved when created a transient attribute with control type checkbox, that transient attribute will be contolling the is_active value.

Adding TextBox in FORM with AddNew Button

I am working in Oracle Apex .i want to add TextBox i-e Disease from AddNew Button because i have Multiple Entries for one TextBox.The entries will be selected from another table through POPUP LOV. Below is the picture.
I don't think I can explain it step by step here, but it sounds like you could make use of a Tabular Form in your case.
In a Tabular form, you can dynamically add-update-delete new rows with a button, and for each field you can have Popop LOVS or Comboboxes to select data from.
Here are a few things to note:
When you insert a Tabular Form in your page, you'll instantly get three processes; one for Automated Row Fetching and two for save-update operations. By default, these processes are triggered through a button. You might want to change that since you have other items to submit in your page.
In a tabular form, you define a SQL query and the resulting columns of that query becomes your fields. For each field, you can select whether you want it to be a Combobox, Popup LOV etc.
Since you want to use a single column "DISEASE" in your treatment table, you can use one of the list item types that support multiple values (generally separated by colons (:)) - for example, a Shuttle.

Creating a Form in APEX to set Variables in a Query for an Interactive Report

I am a relative APEX noob.
I'm running APEX 4.0 against a 10gR2 database.
I've written a query that takes a few inputs (two date fields, for start and end, and a text field for further filtering) and created a dynamic report out of it that works when I pull the input variables (:START_DATE, :END_DATE, :OFFICE) out of it or replace them with static values.
I want to create a form on a page that submits those values to the dynamic report page for use in the query to filter the results the user sees when he or she hits the report.
I'm not having much luck finding a good step-by-step example of this. I created a blank page with two Date Pickers and a LOV select dropdown, but am unsure how to best translate those values into the dynamic report.
Can somebody point me at the right documentation for this?
The following was developed using Apex 4.1 but apart from some cosmetic changes the principles should be the same.
The data comes from the standard scott.emp schema.
Overview
This is page 1, the user can enter an empno and\or a hiredate.
When submit is pressed the following report on a different page is displayed:
How it works
On page 1 I have created the three items shown. The text items are called them P1_EMPNO, and P1_HIREDATE. The action for the button is "Submit Page"
Still on page 1, create a branch with the following values:
This branch navigates to page 2 (which is yet to be developed) and sets the values of items on page 2 with the values from page 1.
Create a new page, in this example this will be referred to page 2.
On page 2 create a new interactive report using the following query:
select e.*
from emp e
Next create two text items in the same region as the report and call these :P2_EMPNO and :P2_HIREDATE. I have found it useful to show these items during development so you can see that the correct values are being passed through to the page. You can always set them as hidden once you happy with the report.
Finally amend the query used by the interactive report to use the values supplied by page 1
Run the application.
You want to reference your page items in your query, which means you'll have to submit your page before your query will pick up the session state of them. What I do when I provide a small parameter form, is to put a button up there as well (i.e. labeled 'Query'), which does a submit.
In your report you can then reference your items. If for example you have 2 items P1_DATE_START and P1_DATE_END, your query could look like:
SELECT firstname, lastname, job
FROM employees
WHERE employment_start BETWEEN to_date(:P1_DATE_START) AND to_date(:P1_DATE_END);

Resources