ADF - Edit multiple rows of detail table simultaneously from master table - java

My query surrounds the Master-Detail relationship in Oracle ADF Development.
What i am trying to do is make a "batch" change to all rows of a particular detail table without having to change each row individually.
For example, i have a master table of countries and corresponding detail tables of all the cities within those countries. The cities table has a column for "dialing code". If i select "UK" from the countries table i want to be able to populate the "dialing code" column of all the cities in UK with the value "+44" without having to go through them one by one.
Is this possible? I'm assuming a Master-Detail relationship is perfect for this but if not, what else is out there?
Thanks in advance for your help.

You can write a service method on your master VO that iterates through all the details of a row and updates an attribute in them.
You can then expose that service method to the client and drag it to add it to a page you are building.
Some links:
http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/ADF_Insider_Essentials/IterateRows/IterateRows.html
https://blogs.oracle.com/shay/entry/am_service_method_-_simple_dem

Related

How to detect changes in records of Dataverse tables

I have a requirement to fetch the records from the Dataverse in which some changes have been done in specif columns values. For example, let's say we have a table named employee in which we have a field called position which can be changed over time from intern, software developer, development lead, etc. If we have 10 records currently and if the position of one of the employees gets changed, I need only that one employee record. I have gone through Retrieve and detect changes to table definitions but I believe it is related to changes in the schema and not related changes in the data. I am using the Spring Boot with Java 11 and to work with Dataverse I am using the Olingo library and also may use the Web APIs if required. Is there a way to detect the changes in the data as described above?
EDIT
To add more details we will have a scheduled job that triggers at X minutes which needs to fetch the employee data for which position has changed from the last fetch time of X minutes. As we can see in the image below, all 3 records are being updated in that X minutes internal and last modified time has been updated for all. I need to fetch the records highlighted in green for which position attribute has changed. For a record with Id 2, I don't need to fetch it as the position is the same.
Solution 1: Custom changes table
If you may and can extend your current Dataverse environment
Create a new table called Employee Change. Add a column of type Lookup named Employee and link it to your Employee table
Modify Main Form and add Employee column to the form
Create a workflow process which would fire on field change. Inside the workflow process you create an Employee Change record and set lookup column value to the changed record
You can now query Employee Change table for changed records. You would need to expand the lookup column to get required columns from Employee table.
Example Web API query:
GET [Organization URI]/api/data/v9.1/employee?$select=createdon, employeeid
&$expand=employeeid($select=employeeid,fullname,column2,column3) HTTP/1.1
Accept: application/json
OData-MaxVersion: 4.0
OData-Version: 4.0
More info on expanding lookup columns can be found here
Solution 2: Auditing
Use built-in auditing feature
Make sure auditing is enabled. Details can be found in docs
Enable auditing on required column in Employee table
Query audit records for changes in Employee table. You have to pay attention only to changes to specific attributes of interest
You will get a list of records changed and then you have to query once again to retrieve columns of the records
Solution 3: Push instead of pull
It might make more sense to push changes from Dataverse to your API instead of constantly querying for changes.
You could use Microsoft Power Automate to create a simple flow which would call your API / platform when change is detected in Dataverse
A good start could be exploring the following Power Automate template: When a record is updated in Microsoft Dataverse, send an email. You could then replace "send email" steps with querying other APIs

Hibernate and Spring Use in Analytics Tools

I want t integrate Hibernate and Spring Frame work in my product. But the thing that stopping me to use. Basically we have dynamic table and column name which change everyday. Currently getting data from table and displaying on UI is all decided at run time. which table to hit. same with the column names.
So how to implemented entity and other concept of hibernate and spring so the object will mapped to data?
for example this is the SQL
select t3521_250_1_1.f_1_1_31,sum(t3521_250_1_1.f_1_1_45) from t3521_250_1_1
where t3521_250_1_1.f_1_1_31 is not null
and t3521_250_1_1.f_1_1_45 is not null
group by t3521_250_1_1.f_1_1_31
order by sum(t3521_250_1_1.f_1_1_45) desc limit 5000000
in above Sql
Table Name = t3521_250_1_1
Column name = f_1_1_31,f_1_1_45
Now these table names and columns name are dynamic. Every day a new table is created with different name and this table has 64 columns but now I am hitting only two columns.
I hope you guyz understand what i want to say
I am not sure whether this is a fix. But can you try creating a view with constant field names and point the POJO to this view.
When you create the dynamic table you can update this view as well.

From database to application scope

my question is involving database and application scope. I am currently running an web application that stores user info(for login), item info and purchase info. The way I am currently doing storing the data is by putting them in a List. I am thinking of storing the data to a database (mysql) and replace the lists. In thinking about it, i thought of whether it would make sense to store data in the database, but also store it in the Lists. Basically, i would be adding to the List via the database. Would it make sense to do this?Thanks!
You should not save the entire list into the field but each element in the list should be a separate row in the table. This is object-oriented design and it would be good practice to do so.
To achieve this, you need to have a one-to-many mapping for the user table to the purchase table. One user can make multiple purchases but each purchase can only be tied to one user. Therefore, your purchase table should contain a foreign key which is the ID for your user table.
For example, table A should be the list of all your users. Table B should contain all your purchases. We can see that Doug has made 3 purchases, (PA,WV and DE) while Bob has made 2 purchases (TN and NC).

How to avoid page Break between two detail rows of table in BIRT

I have eclipse version 3.4.1 for BIRT Reporting,
I need to avoid page break between two detail rows of a table.I didn't found "avoid" option in page break properties.
My table showing data in two detail rows so may Table can be break at the end not in between two detail rows.
Example:
Employee No/Employee Name
--------------------------
Detail row 1 [employee_No]
Detail row 2 [employee_Name]
In above, I need to avoid page break between employee_No and employee_Name
Thanks in Advance.
The easiest solution if your design criteria will allow it; is to use a table with 2 detail columns. Place your employee number in the left column and the employee name in the right column, this way there is no row to break, everything is on the same row.
The harder way but it will allow you keep the existing format and control page breaks between employee name and number is to use a list element with a table inside it.
In this example I have a list with a table (actually two tables) in the detail line of the list. The table(s) each return only one occurrence per primary key (in my case a ticket ID, in yours an employee ID). You can get as fancy as you want with table (I have extra columns for spacing, and two columns of data & Two columns of labels.)
You can then avoid page breaks in your table.
I built this report a couple years ago, and have not done anything similar for a while, so all the details of making it work are not fresh in my mind, but I don't recall it being overly difficult to figure out.
I know this is quite old, but with versions 2.5 and following, you can define where in your layout do you want to avoid page breaks.
To do so, select an element in your layout, go to property editor -> page break and select "avoid" in the desired position.
Keep in mind that, depending on your layout, you probably need to set "avoid" in different point, for example after "first rows" and before "second rows" of each record in the question example.

How do I make the data passed in a table is no longer displayed in the other

I have a problem for a couple of hours does not resolve, is the following.
I have a Table A and Table B.
Table A is filled with a ResultSet, and Table B is being added to products available in Table A
What I am trying to achieve is: Once you click on the Add button Spend the product of Table A to Table B, and the last product is no longer displayed in Table A.
The responsibility to inform the tables that data was added and remove to and from them is completely up to you, and should be handled in each table's model. If you want to 'move' data from one to the other, you need to remove that data from the model of the first table and add it to the 2nd. Once that is done, both models need to be informed of the change via fireTableDataChanged, so they know to redraw.
I would endorse #Colby's and #GETah's suggestion to focus on the model. Also consider giving modelA and modelB access to a common data structure, say List<Product>, where each Product has a boolean attribute that allows each model to to decide what it's corresponding view can see.
Get and remove the selected element from tableA's TableModel and add it to the tableB's TableModel and then refresh both tables.
See this tutorial on using JTable and TableModel

Categories

Resources