Handling Onload events to add server side logic in ADF - oracle-adf

I want to know how do we handle onload event so that we add some business logic once a view is loaded.
In brief this is what i want to achieve -
I have a entity object which i am showing as editable ADF table. Now once the page is loaded and I want the table to show at least 4 rows no matter how many rows exist in Database table. For example, if database table has 2 entries then ADF table should show those 2 rows and additional blank 2 rows in ADF table. And if the database table has 6 rows it should show 6 rows in ADF table.
How to programmatically handle this functionality. What functions and methods i need to override or add.
Any help is appreciated.
Thanks.

There are multiple ways of doing this, including doing this in a method call in the taskflow before you reach the page.
Some options:
https://blogs.oracle.com/adf/entry/an_epic_question_how_to

Related

Refresh Detail Data Grid in WPF

I have a master and detail page. For Master table i have 4 text box displayed in detail layout and for detail table i have data grid. There is trigger on master table which insert some records in detail table. i want to refresh the detail data grid from database. How i can refresh detail data grid with database changes. Here is image. Data is inserted in upper form and there is trigger on upper form which insert data in detail table. I want to load data inserted by triggers in below grid. I m using Entity Framework and using context.SaveChanges(); to save data in database.
Thanks.
Usually Master details information displayed on same page; If there is your case, it is easy. when you are going to insert something in your master table, You can get updated records from detail tables based on PK. One downsize of this approach is, you need to be 100% sure how much trigger will take time.(I am not sure ADO.Net return status of ExecuteNonquery after insert row in specific table or completion of triggers).
In your case when you saveChanges(), make a request to get details against user. Hopefully it is the easiest way to achieve goal.
But if Master and details pages are separate, or information can be changed from other mean. Then you can use SqlDependency. Please Note that SqlDependency only works with SQL server. It monitor DB changes in specific table, and notify ADO.Net. You can handle SqlDependency.OnChange.

How do I write to an access query that uses linked tables?

I have been tasked with create a tracker for company work flow.
I have 10 tables with data in them. There are attributes all the tables have in common. I made a table with those attributes, giving those records a unique ID that could join them to the unique attribute records of the original tables. I am also linking a personnel table to the original tables. All of these tables exist on my SQL Server back end. I Have made a query in Access that displays all the information I was given. I'm going to use the forms in access as a front end to display, edit, and add records.
The issue I am encountering is that I can not write to a query that has externally linked tables. I have spent a lot of time normalizing this data and I know I can get around it by making tables with redundant attributes in SQL and not writing to the query, but rather write to the linked tables instead. Just wondering if there is a way around this.
Thanks
In general, even without linked tables, such queries are NOT updatable.
The general approach when working with multiple tables is to use sub forms for the child tables. That way, each form is only bound to one table. (You are free even to bind such forms directly to the linked table).
Thus, you might say have a customer table and then a table of invoices. So your main form will display the one customer and is bound to that one table.
In the sub form, you can then display all of the invoices.
So to combine multiple tables into a form or screen that allows users to update the data, or add more data, you don’t build some query that joins all the data together, but simply combine several forms into one form. But each of those separate forms will display data from the given related child table.
Here is a typical invoice form thus built in Access:
The top part is the “main” form of an invoice. It is bound to the customer table – one record. Then the multiple lines of detail is the invoice details table. So the form does NOT use queries, but each part of the form and sub forms are bound to the given related tables. You are binding each form directly to the linked table (or tables if you need to show related data like above).
This approach allows you to cobble together a set of forms that edit related tables, but each form is bound directly to the linked table.
So the fact of linked tables or not is moot – such queries are not used to edit data and such queries from link or non-linked tables are NOT updatable.
So your form + sub forms will follow the pattern of related tables that you need to work together as one whole view and means to edit data. You don’t need nor want to use a query to fill these forms.
You most certainly will provide some kind of “search” form, or some means to pull up say one customer invoice, and that invoice along with its sub forms will display the related data, and also allow editing of that data.

How do I get access database to form a relationship from one to many?

In my database I have formed the relationship from one to many on the right of the screen shot, but for some odd reason it will not let me do it on the left of the screenshot. I want to connect both cust_IDs (or customer IDs) and make it a one to many relationship. I would really appreciate any help this because it will allow me to practise forming one to many relationships on Microsoft Access.
Here is my screen shot of the problem
This is easy in Access and will not require any code.
Create a main form based on tblCustomers.
Save this form.
Now create a multiple items form based on tableRentals.
Delete the column for vid_no, and then use the combo box wizard to create a combo box – this will allow you to select from tblVideo, and return/set the vid_no column.
Ok save this form.
Now re-open the main tblCust form in design mode, and drag + drop in the multiple items form you created above.
You should now have a working form.

Adding an order for a customer selected from a list view in Access

I followed this great guide to help me add a search feature to my Access database:
http://www.techrepublic.com/blog/howdoi/how-do-i-populate-an-access-list-control-with-the-results-of-a-dynamic-search/108
At the end it says:
"If you’re building a quote or order, use the list control’s Click or Double Click event to copy record(s) to a temporary table. It’s easy to implement using a fixed query for each search task."
I have managed to display all search results in a list box and I would like to be able to click on a customer to highlight them, and then press a button to add an order to the selected customer. I've been thinking how I could do it and I really can't get my head around it.
Any help would be appreciated.
It depends on how you build your database. My guess is that one easy way would be:
Create a table with customers;
Create an "Order" table with orders where you link the customers through a foreign key
You load the customers in a listbox. While making the name visible, it is actually the ID that you retrieve when clicking the listbox. You can configure this via the wizard in the design view of a table. You can make other forms appear by events on the listbox (eg. on click).
If you managed to retrieve the ID of the customer, and you have the data related to the order (data that can easily be extracted from form objects and loaded into variables ) what you need is an insert statement and insert the values in the "Order" tabel (including the customer ID, which is linked through the foreign key).
This way all order records are linked to the customer and can be queried later.
Due to my limited knowledge on your other requests, I cannot help you any further on the rest of your database design.
I hope that my reply could help you and that I understood your question correctly.
You can access info from a listbox via:
List.Value
Or if it is not the first column then:
List.Column(0,0)
0 being the column and row references.
You may also consider using a listview over a listbox and then you can access the relevant parts of a listview control with the following code:
ListView.SelectedItem
Or if it is not the first column then:
ListView.SelectedItem.SubItems(3)
3 being the column reference

Custom query which returns to data block output in Oracle Forms Builder?

I have these tables
BOOKS
ID | GENREID(number) | COUNTRYID(number) |
GENRES
ID | TITLE
COUNTRIES
ID | TITLE
In my form BOOKS, I need to display:
ID GENERES.TITLE COUNTRIES.TITLE
All I need is to JOIN tables or SELECT data from all tables and display it. It seems that this is impossible with Oracle forms designer. My data block output displays data from the BOOKS table with inserted ids, but not with titles corresponding to those ids from separate tables (e.g. GENRES, COUNTRIES). I can't find where to put a custom query to data block.
I am using latest oracle dev suite home. How do I do this?
There's two common ways to do this:
Use a post-query trigger to populate non-database display fields and an LOV to allow them to insert and update those fields.
Create a view in the database and base your block on that.
The first one is the easiest but they won't be able to search on those non-database fields without a lot of extra work.
The second option allows search but adding and updating data in a view introduces some problems. I usually use an on-insert, on-update, on-delete, and on-lock trigger to handle those function manually and modify the base tables.
http://sheikyerbouti.developpez.com/from_clause/from_clause.htm
--> Read the Step 3
I'm using that one a lot. With that you can build your own queries to Forms and also get block which you can insert/update/delete (of course to one table). And this is how I for example do block which has like user id and user name fields.
But at least in my Forms version it's not possible to change query in run time because it's changing data_source_type back to default.

Resources