Flex: DataGrid with dynamic columns with data from multiple DB tables - apache-flex

Introduction: I'm using java, oracle, flex, blazeDS etc. The part of the DB that is relevant to the task i am trying to accomplish is illustrated in the image below:
The Task table will also have a field called enabled , which i forgot in the figure below :) This field is used to enable some of the tasks based on various criteria, when an admin user presses a "Generate task list" button in the GUI.
Based on this generation of the task list, the users in the system should see a grid as the one displayed in the figure below :
This task list should display all the enabled task as illustrated above. The first three columns are retrived from the Task table in the DB, while the next columns(Column_4....Column_N) are generated based on the number of users in the User table. These columns should display the users alias. Each user is part of a UserGroup(Group), which i will model in either a separate table or in the User table itself, as illustrated in figure 1. The Numbers in the grid are based on the Time field in the Task_User table, while the first row below the users shows the sum of the times for each user.
Question: Im still learning Flex, and looking for every help i can get on accomplishing my goal :) I figure i have to implement a datagrid with dynamic columns. But how will the dataprovider work in this scenario? For each enabled taskid the grid has to fill the right user columns with time values. Any tips/help would be much appreciated! It is also important that loading this grid doesnt take to long :)
Is it possible to get horizontal and vertical text in the grid(like shown above)?

Related

Multiple datasources for same SQL DB

I have an app page that shows information from the same table in 2 places on a page.
In the place A, I want an editable field that is owned by the current user.
In the place B, I want to see the list of entries for all users.
I thought I could somehow have two pointers into the same table by configuring more than one datasource for the table, and bind placeA/B widgets to the two separate datasource.
However, I could not find out how I can bind a panel or widget to a specific datasource within a table.
What bugs me is that clearly the UI allows me to add multiple datasources for a table, so I probably misunderstand what the usercase for multiple datasources are.
My current plan is to ivestigate whether I can create a computed datasource that limits results to just the current user, but I don't understand how I could updated a computed datasource (which is something I want to do).
This is probably less than clear, happy to add clarifying information.
Many thanks in advance for any help
Never mind. App maker behaves as I thought it should be. The two datasources are behaving as two cursors into the same table. For some reason, I could not seem to find the 2nd datasource in the widget dropdown for datasource, but I could find it by selecting "Advanced" and then finding datasource starting from "datasources" instead of "widget.datasource".
Nothing to see here, move along now ;)

Best way to present table data in JavaFX

I'm writing an business application that imports bank statements and allows the user to categorise entries. Once they have done this they can preview their tax statement such as below:
This is currently a gridpane with each cell containing a vbox containing a label and textfield. I don't like it. Its bulky & inflexible.
Each cell is a unique calculation or sum and I'm finding it difficult to get a layout/grouping that I am happy with. I'd like to add descriptive notes adajecent to some cells but this could/would throw the layout out.
I thought about setting specific cells in a tableview like this table:
but seeing this thread How to set value to cell in TableView in javafx and the comment
In JavaFX you generally don't set the values cell by cell like that.
I'm wondering what would be best practice? It seems a bit short sighted that tableviews cannot be used to present (non uniform) non-jpa data.
Update My current work in progress alternative solution is shown in the table above populated by a small class with 3 variables (category, amount and description). Seems better practice.

Creating data source in Tableau

While creating data source in Tableau I want to choose 20 fields out of 100 fields from the table? How to select only 20 fields from the table?
Hide fields you don't want to use. That is the most efficient approach. Tableau will then leave those fields out of the select clause in any queries and exclude those fields from any extracts.
Here is one way to hide fields.
Connect to the data source and stay in the data connection pane
Switch to list view to see the fields listed one per row (for convenience) by clicking the icon to the left of the sort fields switch
Select the fields you don't wish to use, multiple selection is useful here
Right click or use the caret menu (little black triangle) to hide those fields
P.S. Tableau will always leave fields out of the select statement that you don't reference (i.e. don't put on a shelf). So if you are using a live connection instead of an extract, hiding fields can help reduce the number of fields you have to look at on the data pane, but isn't necessary to improve performance. For extracts, hiding fields can reduce the size of the extract and the time to refresh it.
You might think could help performance by writing custom SQL to only request a subset of the columns, but you would most likely be hurting performance instead by defeating the query optimization that Tableau performs.

How does one do a dynamic table in IBM Notes 8.5.3 or 9.0.1?

I'm writing a Notes Client application. Web compatibility is a secondary concern. The language is LotusScript.
The specification: a form to enter lines from receipts. The lines are all saved as part of the same document so that they can be signed as an atomic unit.
When a line is added, it is to be formatted into a table for presentation. Ultimately, this architecture is like an input/datastore/presentation split.
I've managed to get the data stored and signed, and I think I've managed to get it deserializing properly (the LotusScript debugger makes it difficult to see, but it looks right). The problem now is the UI.
Looking at the Programmable Table, it is always a tabbed table with only one row shown per tab. I need a programmable table which can dynamically have rows added to it for display, without forcing new tabs to be created.
This suggests that I would need to use a Rich Text field to contain a table, but thus far my attempts to get anything to display when I try to update a Rich Text field in edit mode have failed. I am forced to conclude that it is impossible.
I cannot figure out how I'm supposed to do a dynamically-displayed list of tabular data like this. Any advice?
Most people just create a table with one row and N columns, with a multi-valued field in each column, and use code to append values to each of the fields in parallel. You don't get borders between rows this way or the ability to do variable formatting of cells, and you have to be careful to avoid letting data length exceed column widths in order to keep everything aligned properly.
If you truly want a dynamic table for presentation with all the bells and whistles that you can get in terms of cell formatting, then the Midas Rich Text API from Genii Software is a commercial solution that can do the job.
I blogged about this a couple of years ago: http://blog.texasswede.com/dynamic-tables-in-classic-notes/
This is a non-XPages solution, but of course you can also use XPages to achieve the same/similar result. It does not use tabs, as each row is a separate table.
Alternatively, you can build your Rich Text Table in another NotesDocument, which you then save. Then use NotesUIDocument.ImportItem (which is undocumented, but present in the R8.5 mail template) to update your NotesUIDocument.
Don't forget to delete the other NotesDocument when you're done.
Another option is to build the table in HTML in computed text, and re-open the document every time you modify it. I have inherited a system that does that, and I hate it...so be warned :)

Update hierarchical data provider in advanced data grid during drag and drop

I am trying to drag and drop hierarchical data in the same advanced data grid, and I would like the data provider to updated when the ADG is updated. (I want to be able to save and load this tree, so it is important that drags and drops are saved.)
I have a sample application (with view source enabled) posted here: www.crcarlson.com/adg/AdvancedDataGridDragAndDrop.swf
The sample app has an ADG showing hierarchical data as well as flat data. The first column of each datagrid shows the rowindex of the underlying data.
If you rearrange the items on the left ADG, the row indexes become unordered. If you click traceTree you see that the data provider is not in order.
On the other hand if you do the same on the right, the row numbers stay ordered even when the objects move around and if you click traceFlat, the data provider is in the order shown on ADG
My goal is to have the data provider order match the ADG order for the left grid which is displaying hierarchical data.
I would appreciate any advice on this, including "you can't get there from here, do it this way."
I noticed a few things while perusing your code and using the app:
Use an ArrayCollection instead of Array as the dataProvider for a view component whose data changes. This might solve your update problems.
If implementing an ArrayCollection doesn't completely solve your update problems, add the necessary logic to a dragDrop or dragComplete event handler.
I get a runtime error every time I drag an item from adg to adgFlat.
Here's Adobe's take on Using Drag and Drop. Specifically check out the last page titled "Moving and copying data". Good luck to you.

Resources