Sunday, April 27, 2008

Record Split Into Table and Form

Those familiar with Oracle Forms, probably know how often in Forms is used UI interface pattern, which splits record into table and form. Simply speaking, one part of record attributes is displayed in table component and second part of attributes is displayed in form component. In Oracle Forms it is usually done for long records with many attributes in order to save space in visual form layout.

You can download sample where this approach is implemented - ADFTableForm.zip. Its simple sample and main trick here is not to forget to specify PartialTriggers property for dependent form element. PartialTriggers must point to parent table Id name:


This means when user will select row in parent table, dependent form will be updated with data from selected record. This action is done automatically in ADF, you just need to use attributes from the same Data Control element.

In developed sample application, when user selects row in a table, Salary and Phone Number fields in dependent form are updated with values from selected row:


Create functionality works as well. When Create button is pressed, empty row is displayed in parent table and fields in dependent form become empty:


User can cancel Create action with Cancel button. Cancel functionality is implemented with Rollback action dropped from Data Control.

10 comments:

Jakub said...

Hi Adrejus,

Note, that Rollback action clear all iterators (also current row selection on master iterator). I think, the better way to obtain "rollback" functionality is to use custom method in backing bean e.g.

ADFUtils.getIterator("Emp").getViewObject().clearCache();

Kuba
www.kuba.zilp.pl

Andrejus Baranovskis said...

Hi Kuba,

It depends on requested functionality, in this sample there is only one iterator and Rollback allows to achieve desired functionality in declarative way without custom code (Oracle Forms clients never like custom code :).

Thanks for update.

Andrejus

Anonymous said...

Hi Andrejus,
I have a very similar application. I have a lov and depending on the value of the lov that takes the user there is a table with a record split to update.
To controll the LOV and the table i´ve used a Task-Flow view into a .jspx page.
Now i have two questions.
1.- To make the record split, i´ve dropped first the tableView from data controls to the TaskFlow view, and then the atribute that i want to see as a form from the same tableView. I´ve defined the partial trigger with the table id, but nothing happens, i`ve been looking your code but don´t find any diference, any idea? The diference with your code is the Tsak Flow and that i´m using TP4.

2.- The create function that i need to use is a PL/SQL call. I have a modify PL/SQL too and this works ok, but to reate is diferent cose first i need a blank row in the view object, to do these i have use this code implemented in appModule

public void InsertarLinea ()
{
DocuEnvImpl vo = getDocuEnvView1();
Row newRow = vo.createRow();
vo.insertRow(newRow);
}

but these code insert a row with the firts two atributes updatables but the others atributes are a blank label, and can´t write on.

Any help is welcome,

Thanks

Rowan

Andrejus Baranovskis said...

Hi Rowan,

1 Question

I have tested my sample with TP4, and it works as expected, so I think you really missing something or similar. Just try to create same thing in separate small application, if it will not work again, you can send it to me, will take a look.

2 Question

I understood your case. I think, it will be more simple, just to create unbinded inputText fields above your table, and use those fields as input row. Those fields can be based on variables in page definition.

Regards,
Andrejus

Anonymous said...

Hi Andrejus,
i´ve tried to do a sample more easy, like your and it works ok.

But when i go to mine again it doesn´t work and i take the next error.

1-jun-2008 17:39:11 oracle.adfinternal.view.faces.config.rich.RegistrationConfigurator handleError
GRAVE: Server Exception during PPR, #1
java.lang.IllegalStateException: ADF_FACES-60058:Intente volver a registrar el componente con otro modelo
at oracle.adfinternal.view.faces.activedata.PageDataUpdateManager._registerComponent(PageDataUpdateManager.java:255)
at oracle.adfinternal.view.faces.activedata.PageDataUpdateManager.registerComponentForPPR(PageDataUpdateManager.java:157)
at oracle.adf.view.rich.activedata.ActiveComponentContext.popActiveComponent(ActiveComponentContext.java:350)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:982)

Any idea?

Thanks

Rowan

Andrejus Baranovskis said...

Hi,

Its very general error, it can happen in many cases.

Regards,
Andrejus

Anonymous said...

Hi andrejus,
But why? when I have a table (a normal view) it works correctly.
And when i delete the table and insert a master detail then I have the error. ¿Wouldn´t it work the same?
If i delete the master detail and insert again the table then it works again correctly, without changing any thing else.
And the table that i´m using is the master table of the master detail.

Really this time i don´t have any idea where to go.

Thanks for all your help

Rowan

Anonymous said...

Hi,
I got news, the problem is with master table and detail form. Using master table detail table it will work when i found why doesn´t refresh the detail table. Other issue. But there is not error an advance i think.

Suposse that this is the same thing, because i can´t do the record split into table and form.

I have three months experience with ADF and don´t know if this could be a bug in TP4.

What you thing?

Rowan

Roberto Furutani said...

Hello Andrejus,
I tried to download ADFTableForm.zip, but I got the error
"The requested URL /~anba1548/blog/ADFTableForm.zip was not found on this server."
The files are moved to another server?

Thank you!
Roberto

Andrejus Baranovskis said...

Hi,

I'm in the process of migration to the new server. Samples will be available in a couple of days.

If you can drop me an email, I can send you app for this post.

Regards,
Andrejus