Row colored based on db field
Hi there. 1st, thanks for taking time to read this and hopefully help.
I have been given this website to work on an its pretty much done in java. Unfortunately I know very little about Java. Over the weeks I have been learning more and more, however I have been asked to do something and I not sure the track that I need to go.
Here is my code
<%
for (int r=0; r<vW.size(); r++) {
W = new Workorder();
W = (Workorder) vW.elementAt(r);
%>
<tr valign="top" class="WOList">
<td valign="top" class="WOList"><div align="center">
<% out.println(W.getInvoiceNum());%>
</div></td>
<td valign="top" class="WOList"><% out.println(W.getSWhoUser());%></td>
<td valign="top" class="WOList"><% out.println(W.getLocationName());%></td>
<td valign="top" class="WOList"><% out.println(W.getProblemDescription());%></td>
<td valign="top" class="WOList"><div align="center">
<% out.println(W.getSTech());%>
</div></td>
<td valign="top" class="WOList"><div align="center">
<% out.println(W.getOpenCloseDate());%>
</div></td>
</tr>
<%
The variable W.getStech needs to be output with a different color row for each Tech. The Tech may have multiple rows and it will vary from day to day.
Can someone assist me in trying to solve this, if not at least point me in the right direction.
Thank you.
You problem related to jsp.
Oh I do not want to get into jsp now so post it here to get better help http://forums.sun.com/forum.jspa?forumID=45
Before doing so, Why you are doing so
W = new Workorder();
W = (Workorder) vW.elementAt(r);
instead of
Workorder W = (Workorder) vW.elementAt(r);
then you for loop does not seems to have an end clause "}"
the how did you created vW which is a list of WorkOrder? where did you get the list from ?
if you want each row (<tr>) needs a different color, then you need need to make the workOrder has a color attribute and in the <tr> you
do
<tr valign="top" bgcolor=<% out.println(W.getRowColor());%>">
or you can put a java list which contains different html color standard
Just a start for you
Hope this could help
Similar Messages
-
Hi there. 1st, thanks for taking time to read this and hopefully help.
I have been given this website to work on an its pretty much done in java. Unfortunately I know very little about Java. Over the weeks I have been learning more and more, however I have been asked to do something and I not sure the track that I need to go.
Here is my code
<%
for (int r=0; r<vW.size(); r++) {
W = new Workorder();
W = (Workorder) vW.elementAt(r);
%>
<tr valign="top" class="WOList">
<td valign="top" class="WOList"><div align="center">
<% out.println(W.getInvoiceNum());%>
</div></td>
<td valign="top" class="WOList"><% out.println(W.getSWhoUser());%></td>
<td valign="top" class="WOList"><% out.println(W.getLocationName());%></td>
<td valign="top" class="WOList"><% out.println(W.getProblemDescription());%></td>
<td valign="top" class="WOList"><div align="center">
<% out.println(W.getSTech());%>
</div></td>
<td valign="top" class="WOList"><div align="center">
<% out.println(W.getOpenCloseDate());%>
</div></td>
</tr>
<%
The variable W.getStech needs to be output with a different color row for each Tech. The Tech may have multiple rows and it will vary from day to day.
This is the printable copy of our work orders.
Can someone assist me in trying to solve this, if not at least point me in the right direction.
Thank you.Hey Everyone. I am still having sooo much trouble on this. I was told (and I need to find a way) to do this without altering the database.
Even if I can't do a color, even having a bold line seperating the people's work orders.
Any help would greatly be appreciated.
I did find this javascript code, and I'm not sure if I could incoporate that into the database.
Heres' the JS
<script type="text/javascript">
<!--
var table = document.getElementById("user");
var tbody = table.getElementsByTagName("tbody")[0];
var rows = tbody.getElementsByTagName("tr");
// add event handlers so rows light up and are clickable
for (i=0; i < rows.length; i++) {
var value = rows.getElementsByTagName("td")[0].firstChild.nodeValue;
if (value == 'mraible') {
rows[i].style.backgroundColor = "red";
//-->
</script>
Now here's the actual java work order
</tr>
<%
for (int r=0; r<vW.size(); r++) {
W = new Workorder();
W = (Workorder) vW.elementAt(r);
%>
<tr valign="top" class="WOList">
<td valign="top" class="WOList"><div align="center">
<% out.println(W.getInvoiceNum());%>
</div></td>
<td valign="top" class="WOList"><% out.println(W.getSWhoUser());%></td>
<td valign="top" class="WOList"><% out.println(W.getLocationName());%></td>
<td valign="top" class="WOList"><% out.println(W.getProblemDescription());%></td>
<td valign="top" class="WOList"><div align="center">
<% out.println(W.getSTech());%>
</div></td>
<td valign="top" class="WOList"><div align="center">
<% out.println(W.getSDateRequested());%>
</div></td>
</tr>
<%
%>
</table></td>
Thanks Again !! -
Change the row colors based on column values in MOSS 2007.
Hi Team,
I am using MOSS 2007 environment. In that I am having one SharePoint list. In that list based on column values rows colors need to change.
Kindly help me anyone on this.
Thanks,
AshokHi Ashok,
Please follow the below link:
http://www.contentmaster.com/sharepoint-2010/conditional-formatting-of-list-views-for-sharepoint-2010-changing-the-font-colour/
http://sharepoint.stackexchange.com/questions/7478/highlight-row-color-based-on-field-values-in-sharepoint-2010-list-view
Best Regards,
Brij K -
ALV rows coloring based on condition
Hai ,
I want Color the rows in the list based on some condition ..
Hope to get the helpful suggestion s on this asap
regards,Hi shishupalreddy,
1. Not only the full row color,
we can also manipulate the color in each cell,
based upon conditions.
2.
IMPORTANT THINGS
a. Extra field in internal table
clr TYPE slis_t_specialcol_alv,
(this field will contain the colour codes)
b. assign fieldname to alv layout
alvly-coltab_fieldname = 'CLR'
c. work area for colour
DATA : clrwa TYPE slis_specialcol_alv.
d. Populating the color
Once again
Loop at ITAB.
*********logic
if itab-field < 0 "---negative
clrwa-fieldname = 'FIELDNAME'. "<--- FIELDNAME FOR COLOR
clrwa-color-col = 6. <------- COLOUR 0-9
APPEND clrwa TO itab-clr.
MODIFY ITAB.
endif.
ENDLOOP.
5. just copy paste in new program
6.
REPORT abc .
NECESSARY / MUST
TYPE-POOLS : slis.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvly TYPE slis_layout_alv.
ITAB DECLARATION
DATA : prg TYPE sy-repid.
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : clname(3) TYPE c,
clr TYPE slis_t_specialcol_alv,
END OF itab.
DATA : clrwa TYPE slis_specialcol_alv.
PARAMETERS : a TYPE c.
DATA : flname TYPE slis_fieldname.
SELECT
START-OF-SELECTION.
SELECT * FROM t001
INTO CORRESPONDING FIELDS OF TABLE itab..
LOOP AT itab..
IF SY-TABIX <= 5.
itab-clname = 'C50'.
ELSE.
itab-clname = 'C30'.
ENDIF.
MODIFY itab.
ENDLOOP.
LOOP AT ITAB.
check itab-bukrs = '1000'
clrwa-fieldname = 'BUTXT'.
clrwa-color-col = 6.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
clrwa-fieldname = 'LAND1'.
clrwa-color-col = 4.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
ENDLOOP.
prg = sy-repid.
flname = 'CLNAME'.
alvly-info_fieldname = 'CLNAME'.
alvly-coltab_fieldname = 'CLR'.
LOOP AT ITAB.
if sy-tabix = 3.
clrwa-fieldname = 'BUTXT'.
clrwa-color-col = 6.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
clrwa-fieldname = 'LAND1'.
clrwa-color-col = 1.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
endif.
ENDLOOP
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = prg
i_internal_tabname = 'ITAB'
i_inclname = prg
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
minimum
*CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2
extra
sy-uname = 'XYZAB'.
prg = sy-repid.
Excluding
DATA : excl TYPE slis_t_extab.
DATA : exclwa TYPE slis_extab.
exclwa = '&OUP'.
APPEND exclwa TO excl.
exclwa = '&ODN'.
APPEND exclwa TO excl.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid
is_layout = alvly
i_callback_user_command = 'ITAB_USER_COMMAND'
it_excluding =
excl
i_save = 'A'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form itab_user_command
text
-->WHATCOMM text
-->WHATROW text
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
BREAK-POINT.
ENDFORM. "itab_user_command
regards,
amit m. -
Hi all
I have a nextensio list on a page.
is there a way to change the background color of a whore row based on
a specific field content?
example I have a field containing the values 0 or 1.
If the field content is 1 the row background color should be RED.
ANy suggestion?
TIA in advance.
tonyDataBoundAPI's you can refer to achieve this.
Search for OLD threads also. Here are some links:
Can we colour the rows in the column of a table
Advanced table row font color- result based change.
Thanks
--Anil
http://oracleanil.blogspot.com/ -
JTable row color based on a certain value
Can anyone please show some code on how
I can change the background color of an entire
row based on a string value from the first column ?
Every time that the first column contains the
string "TOTAL", I want the entire row to have
another background color.
Thanks a lotOverride getTableCellRendererComponent in Table celll renderer.
public class MyTableCellRenderer extends DefaultTableCellRenderer
public MyTableCellRenderer()
super();
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column)
Component comp = super.getTableCellRendererComponent(table, value, isSelected,
hasFocus, row, column);
((JLabel)comp).setOpaque(true);
if(value.equals("TOTAL")
comp.setBackGround(color);
else
set whatever the default background color -
Setting JTable Background Row Color based on cell Value
I am new to Java and JDeveloper (so bear with me). I have managed to create a Swing form using BC4J (Jdev 10g preview) which contains a scrollpane with a view object represented as a table. I would like to be able to color the rows that are displayed within the table differently depending on the value of a cell/column within the row. Its not obvious to me from the property inspector how to do this - I assume it is possible as all the other bells and whistles appear to be in place.
Thanks in advance
SimonSimon,
in Swing this is not done through properties but a custom cell renderer. You can check the Swing tutorial on http://java.sun.com for how to modify the default behavior of a JTable component. A very good book to learn Swing is "Java Swing" from O'Reilly (ISBN 0-596-00408-7).
ADF JClient uses Swing components and therefore everything you can do in Swing you can do with JClient.
Frank -
Alternate row color for table question
I'm alternating the row color on a table, and if I have a
<a href> in
the table, the background behind the <a href> isn't the
same as the row
color based on:
<tr bgcolor="###iif(currentrow mod
2,de('ffffff'),de('efefef'))#">
Is there a way to have the CSS that formats the <a
href> change at the
same time as the background color for the row??How about a way to do it without having to learn something
else (like a
framework??)
Anyone done something like what I'm looking to do? Just
change the <a href>
formatting to go along with the inline iif shown below?
<tr bgcolor="###iif(currentrow mod
2,de('ffffff'),de('efefef'))#">
Steve
"Daverms" <[email protected]> wrote in
message
news:fgn5vi$83b$[email protected]..
> Hi,
>
> Try implementing the "JQuery" framework in your
application. It really
> minimizes the coding time and enables you to concentrate
on development
> alone.
>
> (Try Googling, You can find more JQuery solutions for
this TR alternative
> bgcolor issues, ).
>
>
>
> -
ADF Table cell color based on the value in that field
Dear All,
I want to create a table for our new application which contains a table used to represent the data in a chart format or matrix format,
and each cell of the table should be filled with a colour out of three colors, based on the value belongs to which range eg:(1-8 ->green, 9-20 - yellow etc),
I dont know how to implement this. Please help...
RanjithCheck this out.
How to highlight ADF table row based on column value?
-Arun -
Please Help, I want to change field value in a table, based on another field value in the same row (for each added row)
I am using this code :
<HTML>
<HEAD>
<SCRIPT>
function addRow(tableID) {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var colCount = table.rows[0].cells.length;
for(var i=0; i<colCount; i++ ) {
var newcell = row.insertCell(i);
newcell.innerHTML = table.rows[1].cells[i].innerHTML;
switch(newcell.childNodes[0].type) {
case "text":
newcell.childNodes[0].value = "";
break;
case "checkbox":
newcell.childNodes[0].checked = false;
break;
case "select-one":
newcell.childNodes[0].selectedIndex = 0;
break;}}}
function deleteRow(tableID) {
try {var table = document.getElementById(tableID);
var rowCount = table.rows.length;
for(var i=0; i<rowCount; i++) {
var row = table.rows[i];
var chkbox = row.cells[0].childNodes[0];
if(null != chkbox && true == chkbox.checked) {
if(rowCount <= 2) {
alert("Cannot delete all the rows.");
break;}
table.deleteRow(i);
rowCount--;
i--;}}}catch(e) {alert(e);}}
</SCRIPT>
</HEAD>
<BODY>
<INPUT type="button" value="Add Row" onClick="addRow('dataTable')" />
<INPUT type="button" value="Delete Row" onClick="deleteRow('dataTable')" />
<TABLE id="dataTable" width="350px" border="1">
<TR>
<TD width="32"></TD>
<TD width="119" align="center"><strong>Activity</strong></TD>
<TD width="177" align="center"><strong>Cost</strong></TD>
</TR>
<TR>
<TD><INPUT type="checkbox" name="chk"/></TD>
<TD>
<select name="s1" id="s1">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</TD>
<TD><input type="text" name="txt1" id="txt1"></TD>
</TR>
</TABLE>
</BODY>
</HTML>Hi,
Let me make sure u r working with table control.
First u have to create a event(VALIDATE) to do the validation.
Inside the event,
1. First get the current index where user has pointed the curson
2. Once u get the index read the internal table with index value.
3. Now u can compare the col1 and col2 values and populate the error message.
1. DATA : lo_elt TYPE REF TO if_wd_context_element,
l_index type i.
lo_elt = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
CALL METHOD LO_ELT->GET_INDEX( RECEIVING MY_INDEX = l_index.
above code should be written inside the event.
Thanks, -
SSRS 2012
Dataset (40 columns) including the first 3 rows for Report layout configuration (eg: the <second> row specifies the column background color).
Starting from the 4th row, the dataset contains data to be displayed.
I would like to change the background color of the ColumnHeader/Column based on the value in the same column in the <second> row.
How can I accomplish the this requirement? (this must be applied for all the columns)
ThanksHi Fasttrck2,
Per my understanding that you want to specify the background color of all the columns/column header based on the value in one special column of the special row, right?
I have tested on my local environment and you can add expression to condition show the background color in the columns properties or the column header properties.
Details information below for your reference:
Specify the background color in the Column header: you can select the entire column header row and in the properties add expression in the Background color :
If you want to specify the background color for the entire column, you can select the entire column and add the expression, repeat to add background color for other columns.
If you want to specify the background color based on the value in the specific columns and row, you can create an hidden parameter to get the list of values from the specific column, specify the Available values and default values by select "Get
values from a query", finally using the expression as below to get the specific value you want:
Expression(Backgroud Color):
=IIF(Parameters!Para.Value(1)="1221","red","yellow")
If your problem still exists, please try to provide some smaple data of the report and also the snapshot of the report structure to help us more effective to provide an solution.
Any problem, please feel free to ask.
Regards
Vicky Liu
If you have any feedback on our support, please click
here.
Vicky Liu
TechNet Community Support -
Re: Is it possible to change row colors on array fields ors
HI Martin!
Yes, it is possible to change row colors on array fields.
I have attached a PEX (tools.pex) which has an object which changes FillColor
and PenColor for Arrays. The PEX has it's own test window, so you can try
various combinations. (There are a few other Objects in the Project which are
not relevant
I'm not sure that you can change colors on individual choices in a scroll list.
I haven't tried playing around with it.
The test window actually changes the color of scroll lists as well.
The object keeps track of which rows have changed color, same with pen color, so
that when you scroll it keeps track of which rows are a different colors.
The pex is self-contained, just import the file and do a test run.
Please let me know if you have any problems.
-later
-labeaux
Is it possible to change row colors on array fields or scroll lists?
I need to create a list field that will allow me to dynamically change the
fillColor and/or penColor attributes of individual rows. (I just want to
highlight the rows, and those seem to be the obvious attributes...) It appears
you can't do that on scroll lists (the elements are list elements, and don't
have those attributes) and I can't figure out how to do it on an array field
either. Any ideas for how to accomplish this?
-Martin ([email protected])FreshWebmuse,
Version 2 of iCal has the "Group Calendar" feature. It was released as part of Mac OS X v10.4, and if you really want/need that feature you will have to upgrade to Tiger.
;~) -
Report row highlight based on a page item
Is there a way to highlight a report row based on the value of a page item?
In my case I have a report where the application user requests data in a detail report using a column link in the master report. This loads an id number from my report into a page item (say :P8_ID for example). If this item is null, I want the report rows to all render normally (nothing is selected or the detail report has been closed). If there is an id in that field then I want the row containing the information about that item to highlight (its column link has been clicked selected it to bring up a detail report).
At first glance, this looks similar to Vikas solution (Change the Report row color when clicked but I am trying to make the connection between what has already been done and where I need to be.After looking back, I discovered my value was being set after the report rendered. When I re-organized my calculations and the rest, it worked.
-
Hello All,
I need help adding row color to an entire row. The link below is great but my task is a little different. I need help modifiying the 'BI Publisher Properties' to only make the Condition based on the sysdate 'year' not the entire sysdate. I need to compare field Warranty (12/22/2010) 'year' to the sysdate 'year' (06/28/2010). Does anyone know how to add this logic to to my template? Thanks for reading this Thread.
http://winrichman.blogspot.com/search/label/formattingMy Conditional Format looks like this. I am not clear on how to get the year from each value for the statement.
<?if:xdoxslt:Warranty('yyyy')=xdoxslt:sysdate('yyyy')?><?attribute@incontext:color;'red'?><?end if?>Here's the link to the guide: http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187.pdf
Also check page 7-69 in there to see how to use the condition for a row (@row context).
Also, look at this: http://winrichman.blogspot.com/search/label/row%20color
Alternately, you could use the substring function to just derive the year part and then perform the comparison.
<?if@row:substring(warranty,n,n)= substring(sysdate,n,n)?><?attribute@incontext:color;'red'?><?end if?> -- substitute appropriate values for n.
Thanks!
Edited by: BIPuser on Jun 28, 2010 9:49 AM -
How to find the list of transaction code based on a field ?
Hi Gurus
I have a unique requirement.We are adding a new field into our system and want to know which all t-code contains that field ? So that we can update the user training manual. Can some one tell me the ways and means of finding the list of all the t-code ( or where used e.g functional area ) based on " a field" ?
Thanks in advance
SNHi,
1. Tcode KS02.
2. click on the text "Cost Center"
3. hit F1
4. Click on the technical information
5. in the next screen double click on Field name :KOSTL
6. Select the row for the component KOSTL
7. Click on the display list
8. In the next screen, in the object name:KBAS
Drilldown to transactions.
Here you get a complete list of the transactions.
Hope its useful.
thanks.
Maybe you are looking for
-
After upgrading to iTunes 7.2 iPod shuffle doesn't appear when docked
iPod shuffle working fine before auto-upgrade of iTunes; Plays fine. But does not appear in iTunes when put into dock. Tried switching dock from G4 with OS X 10.3.9 (usual computer for this iPod, older USB) to new Mac Pro (New USB / OS X 10.4.9) and
-
How can I download version 10.7 of itunes for my 10.5.8 OS X Macbook?
I can't transfer music from my Mac OS X Macbook (which has version 10.5.8) to my new iPod touch 5th gen because it requires iTunes 10.7. But because my computer is 10.5.8 (and can't get any updates for later versions), I don't think I can even downl
-
I talked with the computer teck at the bank and she assures me that the problem is not at their end and suggest that I contact Firefox to see why they are blocking this site.
-
I have a Wpf FrameworkElement derived control that offers a custom AutomationPeer: using System; using System.Collections.Generic; using System.Text; using System.Windows; using System.Windows.Automation.Peers; using System.Windows.Automation.Provide
-
SSAS - Many to Many Relationship Grain Filters Out Data (Many to One)
I have a simple Many to One example: One Fact Table record has many Dimensional Items. The Example I'm using is One FactEvent record can have multiple EventMembers. These members are always unique so the relationship is really many to one (vs. many