I'm having a trouble in accessing a Birt Cell value from another cell.
Cell #1 has dynamic text with it's expression. It's binded to a DataSet#1.
Cell #2 has dynamic text with it's expression. It's binded to a DataSet#2.
Cell #3 must use cell1 and cell2, and count an expression based on their value. Let's say cell#1.value()+cell#2.value()
The thing is, I can't find a way to get cell#1 value.
I've tried:
this.setDisplayValue(reportContext.getDesignHandle().getElementByID(997).text());
But got an error on processing
Cannot find function text in object org.eclipse.birt.report.model.api.TextDataHandle#edc8ca
It also didn't have functions like getValue, getDisplayValue
Does anybody know how to solve it?
There is not a lot of information here on your report design. But making a couple of educated guesses. Dynamic text is not the best choice for doing anything with the results afterwords. Two easier paths to solutions are -
1 - If practical join your data sources into one data source with computed columns for your values in cell 1, 2 & 3
In the Outline, right mouse click 'Data Sets' and select 'New Joint Data Set'
2 - Use a 'Data' item for cells 1 & 2, this will allow you use the 'Aggregation' item to sum (or otherwise work with) the values in the 'Data' item
In the palette of report items with 'Dynamic Text'
Related
I worte a code, that generated an output, where other people should choose an acknowledgment value 0,1 or 2. But some people ignored the "value rules" and they wrote other things into the cells. Now I want to generate the output with radio buttons and a textfield for comments. It should not be possible anymore to write other things into the ACKValue cells.
Is this possible to code with Java Apache? Can somebody give me some keyword how to do it. At the end it should be possible to read in the file again and sort the rows with respect to the chosen value.
I am using Kettle for data migration for moving data, I come across a scenario where i got a excel where the column header is merged, When i read it only the first cell gets the name others are empty, Kettle can only duplicate values vertically, I have a macro which does the exact same thing, But some one has to do it manually, Is there a java code i could run to achieve this?
What do you mean by merged? In the excel file is there one cell with all the values? Is there a separator? If it's not a great deal of columns I'd just manually add them or change them to what I want using a select step. If you'd like to upload files I'll take a look.
I think, got the solution. Here Java code is not required. Please follow the step to achieve your result.
Step1: Drag and drop Microsoft Excel Input to the canvas.And go to Content uncheck Header.
Step2: Go to !Fields tab. See the below image and fill up like below image.
Step3:Go to Additional output fields tab and then check for sheet row nr field and fill up the check box with row_number.
Step4:Finally, click on preview button. You get the result like below.
If you see the result. First three rows are unnecessary. You can filter those three rows by using Filter step this part I'am not done.
Generally, for GWT list views of POJOs/DTOs I typically use a ListDataProider and a CellTable and place the CellTable into a Vertical Panel with a SimplePager. All is well.
I have a scenario where the Pojo's DTO is only 3 fields; and as such it would be nice to create a list view where I can put two columns of my DTO's next to each other and page accordingly. For example, instead of just three columns per row, there would be six where the first three columns represent one DTO instance and the next three (repeated) columns represent a second DTO instance.
Has anybody successfully done this before using celltables or other GWT component? Looking for a simple approach.
My fallback position (which is good enough) was to use a FlexTable with a search form and caping the results to 40 records. Two columns of 20 DTO's.
I have done something similar. I was using a Grid. The key to align the components was this line of code:
myGrid.setWidget(position/COLUMNS_NUMBER+1, position%COLUMNS_NUMBER, lName);
Where lName was a GWT Label with the element (property) to be displayed (the 'name' property of my POJO / DTO). COLUMNS_NUMBER is my constant for how many columns I want to display.
I was displaying just this property, but you could easily adapt this idea to show more than one property of more than one DTO in different columns. My algorithm was just iterating through the DTO collection, getting each DTO's name prpoerty, which would be inserted as a Label in the Grid via setWidget, and updating the index variable position, which starts in 0.
I also needed this condition:
if(position%COLUMNS_NUMBER==0){
list.insertRow(position/COLUMNS_NUMBER +1);
}
I'm displaying only onew property of each DTO, but the idea is also not having each one in a different row, and customizing the number of columns displayed. Again, you can adapt that to meet your needs, by adapting the way you increment the index variable position and the column where you display the DTO property or (even simpler) by following the same approach and just choosing a different property to display each time depending on
postiont%3
since you want to show 3 properties of each DTO.
I'm trying to find a way to make a Java table (Swing component) that can wrap the list of columns into multiple lines per row.
/[ Column Hdr A ][ Column Hdr B ]
Hdr |[ Column Hdr C ][columnHdr D ][ColumnHdr E ]
\[ column Hdr F ][COlhdr G][colhdr H][CH I]
/[ Cell 1 A ][ Cell 1 B ]
Row 1|[ Cell 1 C ][cell 1 D ][Cell 1 E ]
\[ Cell 1 F ][Cell 1 G][Cell 1 H][C 1I]
...
Where each column size is independent of any other. IE: I'm not doing spanning or column header grouping. It should retain the column resizing, hiding and sorting features. Drag and drop re-ordering would be nice but isn't necessary.
So I've searched everywhere for something like this. All I've found are various schemes for spanning cells or using fixed width sub-columns. There was one person who claimed to have done it by overriding getRect, but there was no code to look at, so I'm not sure how that would work wrt to resizing or hiding columns, and how would you specify which columns went where?
I've considered just extending TableColumn to include a "sub-row" property but that means also having custom TableColumnModel, JTableHeader and Jtable, AND Jpanel. And I suspect that the renderer and all the LookandFeel UIs would also have to be modified.
An ugly hack that occurred to me is to create one table per sub-row of columns, and then use some form of mutant jpanel to expose the rendered rows interleaved down the y axis. I'm not sure that would work with scroll bars though.
So, does anyone have a neat, concise way to implement this? Any suggestions about how to proceed?
I would hope that you would re-organize the output to be more human readable. While this does fit the data onto the page, a human reading it would have a great deal of problems trying to understand what table cell belonged to what header and which row was which.
Can you create rows with only the 'important' data visible first, then the user could click (or some gesture) to open the more detailed results? Or include multiple cell values together in a multi-line cell to reduce the data to a single row per record?
This gives you two great benefits. First the data will be understandable at a glance, and second, you can use the existing table implementations and save yourself the significant development work.
Finally, have you tried using an HTML widget to display the data? You could create the table as divs in HTML and have the widget wrap the rows. Then you could style the cells for each column to be a fixed width.
I can't offer you any code, but you could look into customizing the table model (class MyTableModel extends AbstractTableModel {...}).
The approach could be to overload the SetValueAt(Object value, int row, int col) method so that writing row 1, col 3 for example would actually write row 2 , col 1 and so on to display multiple lines for 1 line of you data table
Do you indeed need the behaviour which prevents some columns from scrolling?
It is a quite standard usability solution. I would recommend you to come up with a dialog allowing to hide and freeze columns. In this case users could organize the viewport the way they feel best at the moment. Here is an example of scroll freezing.
The second option may well be HTML. You can generate whatever you want this way. Though this solution may have a limitation if you need to edit your data.
Ergonomics uggestions:
Is it acceptable to present headers or data vertically? Sometimes it is better readable.
Basically JTable supports adding swing components including nested tables or cells. please refer to the ff links
com.lang.java.gui discussion
a similar thread
I have an Excel template with first 5 columns left blank (to be populated from an XML). The sixth column has a drop-down list such that depending on whatever value is selected from the list, a value appears in 7th column. This is done by using INDEX-MATCH formula for the 7th column.
=INDEX(Sheet7!$B$1:$B$312,MATCH(F3,Sheet7!$A$1:$A$312,0))
The task is to take this template Excel, and using POI, populate the first 5 columns and generate a new Excel workbook. (Not changing in the existing sheet).
The problem is when I generate the new Excel workbook, the formula isn't copied over from the template. It is really important to retain the formula for the task I am working on. I read about
formulaEvaluator()
but I don't think it'll work in that case because I need the formula to be retained as it is. I cannot evaluate it before copying as there won't be any data in column 6 at that point to evaluate the formula and store the value.
I'd really appreciate if someone who has any experience in this area could guide me a bit.
If you have access to the Cell, simply call:
String formula = cell.getCellFormula();
Note though that this will only work if the cell is formula cell. IE: cell.getCellType() == Cell.CELL_TYPE_FORMULA. If the cell is not a formula cell, you're going to end up with an IllegalStateException as described in the API