Both tables belong to same datasource (ex. Authors). The Authors are assigned to another Datasource say (Scientific Papers). The assigned authors will work on that Scientific Paper.
I want to display first table (ex. Assigned Authors) that shows list of authors assigned to that particular “scientific paper” by ID.
I want to display the second table (ex. Unassigned Authors) that shows total list of Authors who are not assigned to that “scientific paper”.
I would like to use an “Add Button” to Assign Authors who belong to table two(Unassigned Authors). Both tables should refresh based on Add/Removal of Authors.
I would like to know the Query structure to display the two tables. Table 1 (Authors assigned to scientific paper by ID). Table 2 (Authors who are not assigned to that scientific paper but can be part of other papers)
I also would like to know on how to assign an Author from Table 2(Unassigned) to Table 1(Assigned) using Add Button. I want both tables to refresh dynamically when changes are made using Add/Remove Button.
First of all, I should say that you will have to use a number of datasource for all purposes
<!-- This datasource is used as options datasource for the LookupPickerField component
to choose a scientific paper -->
<collectionDatasource id="scientificPapersDs"
allowCommit="false"
class="com.company.authorsandpapers.entity.ScientificPaper"
view="_minimal">
<query>
<![CDATA[select e from authorsandpapers$ScientificPaper e]]>
</query>
</collectionDatasource>
<!-- This datasource is used to display all unassigned authors -->
<collectionDatasource id="authorsDs"
class="com.company.authorsandpapers.entity.Author"
view="author-view">
<query>
select e from authorsandpapers$Author e where e.scientificPapers is empty
</query>
</collectionDatasource>
<!-- This datasource is used to display all authors that are assigned to a scientific paper
that is chosen in the LookupPickerField component -->
<collectionDatasource id="authorsByPaperDs"
class="com.company.authorsandpapers.entity.Author"
view="author-view">
<query>
select e from authorsandpapers$Author e
join e.scientificPapers sp where sp.id = :component$paper
</query>
</collectionDatasource>
A screen layout is presented by a few components: the LookupPickerField to choose a ScientificPaper, two Tables to display Authors and two buttons to assign/unassign Authors:
On Table 1 (Assigned Authors). I would like to display list of Papers (other ScientificPapers) that belong to that Assigned Author in a row using generatecolumn.
I can use Popup Button to display the list of Paper belonging to Author (Example Assigned Author) and use addaction to perform action (like opening that paper by id).
The issue is : Table 1 needs 3 collection Datasource. authorsByPaperDs, authorsDs and scientificPapersDs.
All 3 datasources are linked by One to Many Relationship. Author can have multiple Papers. Assigned Author can have multiple papers. ScientificPapers can have multiple Assigned Authors.
I believe this can be achieved using DataManager.
Some sample implementation or idea for adding a generatedcolumn to AssignedAuthor Table which shows list of all Scientific Papers belonging to each Assigned Author in a row using DataManager will be helpful.
I am aware of the method for generating a column and adding an action.
I am not aware on how to add the list (Assigned Author with list of ScientificPapers) using DataManager to the new column of Assigned Author Table.