How to color single column cells with different colors in classic report based different conditions
Hi ,
Am working on Oracle Apex 4.2 version. Am trying to generate a classic report with different cell colors based on the conditions.
I tried the solution provided in the below link.
https://forums.oracle.com/message/9518723#9518723.
I tried the same query given in that link.
SELECT e.*,
CASE
WHEN sal < 1000
THEN 'red'
WHEN sal BETWEEN 1000 AND 2000
THEN 'yellow'
WHEN sal > 2000
THEN 'green'
END the_color
FROM emp e
And, I hidded the column 'the_color' in Report Attributes,
the Column Template1 has the code , <td #ALIGNMENT# headers="#COLUMN_HEADER_NAME#">#COLUMN_VALUE#</td>.
After this, what are the steps did I miss here. Because am not getting the report which I need.
Kindly do provide solution.
Thanks,
yashu.
SAL column values should visible with different color based on the conditions. Same way i did in my report it was working for me. Please refer the below links for more information,
https://forums.oracle.com/thread/1047891
http://dbswh.webhop.net/htmldb/f?p=BLOG:READ:0::::ARTICLE:351800346145832
Thanks
Lakshmi
Similar Messages
-
We work with SRM 5 Ext' Classic & report based on organization plan
Hello expert,
We work with SRM 5 Extended Classic scenario and BW for reports.
We have a lot of purchasing types and we need a good report that can give as a clear picture of the purchasing process according to the organization units (departments). We have one purchase organization and a lot of purchase groups, and the way that the system is built doesnu2019t support this requirement. We need a report that is based on the organization plan.
For example:
We need the option to extract all HR unit purchase documents or all direct supply goods that are purchased by the supply chain department. The report also needs to give a clear picture of the purchase operations and costs of every unit.
Thanks,
GilClosed but Unanswered
-
Grep: How to fill a table cell with certain color
I have an excel sheet with 5000 rows that needs to be formatted in Indesign.
1. Is there a way to get a certain color fill of the cell depending on text. Lets say if the text is "apple", the cell should fill with red (and text also color red to make it disappear).
2. How do I make two different character styles to appear in the same cell (information is tab-separeted but sometimes I would like to have 2 "paragraphs" in one cell sometimes – with that I mean two tab-delimited cells from excel to appear in ONE cell in indesign).
Thanks in advance
Example of what I would like to accomplish: http://tinypic.com/r/vo4och/6Yes but wouldn't that make the field contain a string?
I tried something like that, and every field I edit becomes left-justified, and String (instead of int, float which is right-justified)
Matthew -
How do you highlight several cells with the mouse in numbers
how do you highlight several cells with the mouse in numbers
Hi David,
Using only the mouse, you can select a contiguous range of cells using the method described by dwb.
For larger (but still contiguous) ranges you might prefer this method:
Click the first (top left) cell of the desired selection.
Scroll to the last (botom right) cell of the desired selection.
Shift-click the bottom right cell to select it, and all of the cells in the rectangular array defined by this and the top left cell selected in step 1.
To select two or more non-contiguous cells:
Click on the first to select it.
Command-click on another to add it to the selection.
Repeat as necessary.
Regards,
Barry -
How to return all columns starting with E?
How to return all columns starting with E in emp table?
My attempts (below) were unsuccessful.
SQL> SELECT E* from emp;
SELECT E* from emp
ERROR at line 1:
ORA-00936: missing expression
SQL> SELECT E.* FROM EMP;
SELECT E.* FROM EMP
ERROR at line 1:
ORA-00904: "E": invalid identifier
SQL> SELECT EMP.E* FROM EMP;
SELECT EMP.E* FROM EMP
ERROR at line 1:
ORA-00936: missing expressionYou need to do it dynamically:
SQL> var cur refcursor
SQL> declare
co varchar2(40);
begin
for c in (select column_name from cols where table_name = 'EMP' and column_name like 'E%') loop
co := co || c.column_name || ',';
end loop;
open :cur for 'select '|| rtrim(co,',') || ' from emp';
end;
PL/SQL procedure successfully completed.
SQL> print cur
EMPNO ENAME
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
7839 KING
7844 TURNER
7876 ADAMS
7900 JAMES
7902 FORD
7934 MILLER
14 rows selected. -
How to Print a text in bold format in a classic report ??
How to Print a text in bold format in a classic report ??
hi
u can use
<b>FORMAT INTENSIFIED ON.</b>
regards
ravish
reward if useful -
How to create a column graph with colors per set of values
I need to create with Microsoft Excel, a column graph that based on different values, each column will contain different color.
To be precise:
E.g.:
- Green: If it is 0
- Orange: If it is between 0 and 10
- Red: If it is more than 10
I would appreciate to help me how to do this.Hi EriValidata,
According to your description, I get the result as shown in the following figure.
Is this a correct result? If yes, this is an excel chart with conditional formatting. Please try the following steps to create the chart.
To accomplish this task, you will need to create three additional columns of data and plot those three columns of data-and not the original column of sales data – in a stacked column chart. As shown in the figure.
And the formula in C2 is: =IF(AND(B2>0,B2<=10),B2,0). The formula shows the value in column C if it falls between the limits in rows 0 and 10; otherwise it shows 0. The formula is filled into the range C2:E4.
Then we select the source data with A2:A4 and C1:E4, as shown in the figure to insert a column chart. The chart now shows 3 sets of colored bars, one for each data range of interest.
And I upload a TEST2.xlsx file on OneDrive, you can download this file via this link:
https://microsoft-my.sharepoint.com/personal/v-lzng_microsoft_com/Documents/Shared with Everyone
Hope it’s helpful.
Regards, -
Crystal Reports XI - How to pull same column value with different select...
I have a report with many (around 30) sub reports and it is giving serious performance issue. I am currently finding out a strategy to improve the performance. I see that most of the sub reports are taking same parameters from main report except for one parameter which is different for each sub report and hard coded in them and pulling up the same column value from a oracle database with a different select criterion. I am trying to find out a way using either of command/crystal formula/SQL expression which can do the same job for me and give me performance improvement. I tried to take the parameters from the main report in one sub report and mapped them to parameters being transferred to the command and then drag and drop the field for which I need to display the value but due to some reason it is not returning values when I am trying multiple commands...I need some help in selecting a strategy for this issue resolution and some guidance....Any help would be highly appreciated....
My version is 11.5.8.826. First of all I need to make it clear that I have 6 set of sub reports and each set has 5 sub reports. So if I can resolve the issue for one set, I resolve it for all. The sub reports are doing nothing but fetching a column value using a simple SQL SELECT query and appending to the right of a box in main report. The issue is that all these queries embedded into the sub reports are using same SQL except for one parameter in the "where" clause and they are fetching same column value from the database and fortunately all of them are returning same number of results. So at the end these results create a table when run. The only way I can stop using sub reports is by creating a table in the main report and use some object(formula/command/SQL expression or whatever) to fetch that column value using the same filter conditions. But please take a note that I need to use and append the same column value from a database table and use different filter conditions and append them to the right so that at the end they create a table...as long as I get the table in the output with a decent performance , anyone will be least bothered about what I used inside the report.....please ask me as many questions to get more lights on the issue....
-
Coloring an ALV Cell with DYNAMIC INTERNAL TABLES
Hello Gurus,
I need your help regarding coloring of a cell in my ALV Grid report with DYNAMIC tables.
I have used the call method in calling my ALV. (CALL METHOD gr_alvgrid->set_table_for_first_display).
Now my problem is, I can not bring out the cellcolor succesfully, I always ended up to dump (GETWA_NOT_ASSIGNED = You attempted to access an unassigned field symbol
(data segment 32807).
What I have done:
I've created 2 internal tables:
*1st table
*After appended all of my columns to gt_fieldcat
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fieldcat
IMPORTING
ep_table = gp_both.
ASSIGN gp_both->* TO <i_xtab1>.
*2nd table
Appended these column for CellColor
CLEAR wa_gtfldcat.
wa_gtfldcat-fieldname = 'CELLCOLOR'.
wa_gtfldcat-ref_table = 'CALENDAR_TYPE'.
wa_gtfldcat-ref_field = 'COLTAB'.
APPEND wa_gtfldcat TO gt_fieldcat.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fieldcat
IMPORTING
ep_table = gp_alvgrid.
ASSIGN gp_alvgrid->* TO <i_xtab2>.
*Work Areas for tab1 and tab2
CREATE DATA dref1 LIKE LINE OF <i_xtab1>.
ASSIGN dref1->* TO <wa_xtab1>.
CREATE DATA dref2 LIKE LINE OF <i_xtab2>.
ASSIGN dref2->* TO <wa_xtab2>.
*Move contents of table1 to table2 and modify cellcolor column
LOOP AT <i_xtab1> ASSIGNING <wa_xtab1>.
*-----Cell color assignment
DESCRIBE TABLE gt_fieldcat.
DO sy-tfill TIMES.
READ TABLE gt_fieldcat INTO wa_gtfldcat INDEX sy-index.
ASSIGN COMPONENT wa_gtfldcat-fieldname
OF STRUCTURE <wa_xtab1> TO <fs4>.
IF sy-subrc NE 0. EXIT .ENDIF.
ASSIGN COMPONENT wa_gtfldcat-fieldname
OF STRUCTURE <wa_xtab2> TO <fs3>.
IF sy-subrc NE 0. EXIT .ENDIF.
<fs3> = <fs4>.
ENDDO.
ASSIGN COMPONENT 'CELLCOLOR' OF STRUCTURE <wa_xtab2> TO <fs3>.
IF sy-subrc = 0.
PERFORM modify_cell_color USING 'ZZMATNR' <fs3>.
ENDIF.
APPEND <wa_xtab1> TO <i_xtab2>.
ENDLOOP.
*Call ALV
gs_layout-ctab_fname = 'COLORCELL'
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_outtab = <i_xtab2d>[]
it_fieldcatalog = gt_fieldcat
it_sort = lt_sort
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
*--->Exception handling
ENDIF.
FORM modify_cell_color USING p_fieldname TYPE lvc_fname
pt_cellcolor TYPE table.
DATA l_cellcolor TYPE lvc_s_scol.
CLEAR l_cellcolor.
l_cellcolor-fname = p_fieldname.
l_cellcolor-color-col = 6. " Red.
l_cellcolor-color-int = 0.
l_cellcolor-color-inv = 0.
INSERT l_cellcolor INTO TABLE pt_cellcolor.
ENDFORM. " MODIFY_CELL_COLORHi,
The internal tabl which you are using to display the output should have one column in the end.
The cell in this column will contain an internal table of type 'lvc_s_scol'.
The contents of this internal table will be the field names of all other columns of your main internal table in the field FNAME and the required color in the field COLOR.
Please note that the field COLOR will have a hex value for different colors.
In the stucture is_layout whihc you pass to the method 'set_table_for_first_display'
the name of this last column should be given to the field 'ctab_fname'.
This will help you to give the colors to each cell.
for example
I have my data table as follows:-
ITAB1
MATNR MAKTX COLOR_TAB
1 ABC FNAME COLOR NOKEYCOL
MATNR 8000
MAKTX 8000
2 XYZ MATNR 10000
MAKTX 10000
So my internal table ITAB1 had 3 columns MATNR MAKTX and COLOR_TAB.
And COLOR_TAB will contain an internal table with 3 columns FNAME COLOR and NOKEYCOL.
The value to importing parameter IS_LAYOUT-CTAB_FNAME will be COLOR_TAB.
This will help you to assign various colors to the cell of the internal table ITAB.
When you have to change any color, then you will have to just change the entries in cell COLOR_TAB for the particular row and cell.
Regards,
Ankur Parab -
How to do Single Column Visble and Invisible
Hi All,
I tried following code for doing Column visible and invisible. But in this when i click single columne all values invisible. I want when i again click on that Column i want to bind previuse value.
Means i have taken one Matrix and in that Matrix of first column i taken ChooseFromList and on this i fill second column also. When i click on second column it invisible. I want when i click again i want bind that value which i got on ChooseFromList.
I tried hardcode value "X". That line commented in code.
Can anybody suggest me how to do it ? How to get again that value ?
Code is,
If pVal.ColUID = "V_0" Then
For i = 0 To matrix.RowCount - 2
If matrix.Columns.Item("V_0").Cells.Item(i + 1).Specific.Value = "" Then
' matrix.Columns.Item("V_0").Cells.Item(i + 1).Specific.Value = "X"
Else
matrix.Columns.Item("V_0").Cells.Item(i + 1).Specific.Value = ""
End If
Next
End IfHi,
I guess i understood now.. Plz bind all ur cols in the matrix u can take a look at the following code snippent to bind the cols
oForm.DataSources.UserDataSources.Add("Usr1", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 50)
objMatrix = oForm.Items.Item("matIndent").Specific
oCol = objMatrix.Columns.Item("V_20")
oCol.DataBind.SetBound(True, "", "Usr1")
oForm.DataSources.UserDataSources.Add("Usr2", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 50)
objMatrix = oForm.Items.Item("matIndent").Specific
oCol = objMatrix.Columns.Item("V_21")
oCol.DataBind.SetBound(True, "", "Usr2")
Execute this code after the form is loaded. (U can use the load Event or if the form is loaded with the Menu u can also use the menu event.)
Hope it helps,
Vasu Natari. -
Hi Guys,
I have a JTable which I need its cells to have 2 colors (indicating different type of data for the same cell). I could not find a way to do this. Anyone can help me out here?
Thanks in advance
EmanPhHein wrote:
eman_c wrote:
Hi,
I already checked that page, and as far as i understood (and please correct me if I am wrong) the renderer lets you control one cell (which is great) but one cell can be applied with one ForGround color. What I needed is that in the same cell, part of the data is colored red for example and the other in green. If it is indeed possible using cell render, could you please explain how?
Thanks again
EmanSorry, I don't think it is possible at all to have different background colors in one cell. But you could however set different text colors in the same cell by using html.Err...
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import java.util.*;
import java.util.regex.*;
import java.text.*;
public class ShadeCellDependingOnValue extends JPanel
static final Object[][] tableData =
{1, new Double(10.0)},
{2, new Double(20.0)},
{3, new Double(50.0)},
{4, new Double(10.0)},
{5, new Double(95.0)},
{6, new Double(60.0)},
static final Object[] headers =
"One",
"Two",
public ShadeCellDependingOnValue() throws Exception
super(new BorderLayout());
final DefaultTableModel model = new DefaultTableModel(tableData, headers);
final JTable table = new JTable(model);
table.getColumnModel().getColumn(1).setCellRenderer( new LocalCellRenderer(120.0));
add(table);
add(table.getTableHeader(), BorderLayout.NORTH);
public class LocalCellRenderer extends DefaultTableCellRenderer
private double v = 0.0;
private double maxV;
private final JPanel renderer = new JPanel(new GridLayout(1,0))
public void paintComponent(Graphics g)
super.paintComponent(g);
g.setColor(Color.CYAN);
int w = (int)(getWidth() * v / maxV + 0.5);
int h = getHeight();
g.fillRect(0, 0, w, h);
g.drawRect(0, 0, w, h);
private LocalCellRenderer(double maxV)
this.maxV = maxV;
renderer.add(this);
renderer.setOpaque(true);
renderer.setBackground(Color.YELLOW);
renderer.setBorder(null);
setOpaque(false);
setHorizontalAlignment(JLabel.CENTER);
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col)
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
if (value instanceof Double)
v = ((Double)value).doubleValue();
return renderer;
public static void main(String[] args) throws Exception
final JFrame frame = new JFrame("Fred120");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(new ShadeCellDependingOnValue());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
} -
How to Sort single column in webdynpro table
Hi all
I have requirement as follows.
i have webdynpro table with the following columns like Date,firstname,lastname,address etc.
now when i run the the application the table is populating the data at runtime that is fine.
i need as soon as table is loaded , Date field in the table should be displayed the values in the decending order...i have the requirement as follows...
how to sort the single column in table ...by default the values of the column displayed with decending order as soon as table displays at runtime....i dont want to click any button specific button to do the sort for that column
Regards
binduHi, I solved the same problem by modifying the sort() method in the default TableSorter class so that it takes a column id and direction rather than an event.
I assume you have read the TableSorter tutorial.
Like this. (This was done on nw ce 7.1 btw but may work on older versions as well.
Oh and then you just call the sort method right after you have made the request
//Code that goes into controller/view to execute sorting
wdContext.currentContextElement().getPensionplanTableSorter().sort("MyColumnId", "Up", wdContext.nodePensionPlan());
//Part of TableSorter.java
//The original method that needs an event. Now it just calls the new method
public void sort(IWDCustomEvent wdEvent, IWDNode dataSource) {
// find the things we need
String columnId = wdEvent.getString("selectedColumn");
String direction = wdEvent.getString("sortDirection");
sort(columnId, direction, dataSource);
//This is the new method.
public void sort(String columnId, String direction, IWDNode dataSource) {
if (columnId == null || direction == null ) {
return;
IWDTableColumn column = (IWDTableColumn) table.getView().getElement(columnId);
NodeElementByAttributeComparator elementComparator =
(NodeElementByAttributeComparator) comparatorForColumn.get(column);
if (elementComparator == null){
//not a sortable column
column.setSortState(WDTableColumnSortDirection.NOT_SORTABLE);
return;
// sorting
elementComparator.setSortDirection(WDTableColumnSortDirection.valueOf(direction));
dataSource.sortElements(elementComparator); -
How to access single column in table?
Hi,everybody!
How to access a single column in table.
I sorted my table with standard TableSorter.
Now I need to get one column from this table to
do something with it's data.How do I get it?
Regards,
MichaelHi Michael,
If you just want to retrieve the data, you could use the following code.
//Get the node which the table is bound to
IWDNode node = wdContext.nodeTable();
//iterate thru the elements
for(int i = 0 ; i<node.size();i++)
IWDNodeElement ne = node.getElementAt(i);
Object value = ne.getAttributeValue("<column name>");
//Here you have the data in the value variable
//and you can manipulate this now
Regards,
Sudeep -
How to use single column in a group by clause
hi frs
i hve used sum function in a sql how to use a single column in a query.
for ex
select sum(sal),ename,job,deptno,empno from emp
group by deptnowhether its possible to use single column in a group by class.
i want like this because in my custom report i need it. Report query has more than 30 column so its not possible to use 30 columns in a group by.
pls help.
Thanks
RajeshMaybe something like this -
Select ename, job, deptno, empno, sal, col1, col2, col3, col4 ......, coln
From
Select SUM(sal) sal, deptno deptno_i
From Emp
Group By deptno
,Emp
Where deptno = deptno_i
Shailender Mehta -
How to integrate single sign on with third party system
we are in the process of implementing istore application. we already have home grown isupport application to contact support personnal for any issues. Now we are wondering how do we integrate oracle applications single sign on with our third pary system. Is there any recommendation provided by oracle to achieve the same.
We too are in the process of implementing iStore with SSO features.
And if you believe me it seems to me as nightmare.
In our scenerio we are intgrating this SSO with Third party access control too (AD and Siteminder). I would request you to please respond me on the following mail id , so we can share our experince which will help us in our implementation
[email protected]
regards and thanks in advance
Vikas Deep
Maybe you are looking for
-
Problems while activating ABAP proxy
Hi All, I am dealing with a problem while I am trying to activate a proxy in Sproxy tcode Package Check for Table/Structure ZDT_ENVIO_DADOS_MESTRES_IN The object TABL ZDT_ENVIO_DADOS_MESTRES_IN uses TTYP PRXCTRLTAB Table Type PRXCTRLTAB Package
-
Macbook Pro Self Assigning IP Addresses
Hi, I bought a Macbook Pro in August of this year, that came with Lion. I had no trouble connecting to the internet in my apartment, and had no problem connecting to the internet on my college's campus. However, a few weeks ago, I brought my computer
-
Compling cups 1.3.5 on solaris 10 x86
hello i try to install CUPS 1.3.5 on solaris 10 x86. configure ends normally but when i do "make" it ends like this: Linking cupsd... Symbole premi�re r�f�rence non d�fini dans le fichier ldap_initialize
-
Elements 11 won't support RAW for Nikon D3300, no plug-in updates
Got a new Nikon D3300 and Elements 11 doesn't seem to support the file format. I keep getting an error. Tried to find a plug-in update but there is nothing for 11. I need this fixed ASAP - what can I do!!??
-
[SOLVED] radeon/radeon dual GPU halp:)
Hey all, I just got a new laptop with radeon/radeon hybrid gpus and I'm a little lost as to how to go about setting anything up. The hybrid wiki only really mentions ati/intel, but I've got both my cards on the radeon driver. I'm pretty sure arch has