To color a specific row in a Table UI element
Hello Experts,
We have a requirement to highlight (with distinguish color) a specific row of a table UI based on column data.
Suppose we have a table with 5 column and 10 row, now if the data on 5th column greater than some XYZ value then we need to highlight the specific row with a different color.
Can anyone please help me to achieve this requirement?
Thanks & Regards,
Sambaran Chakraborty
Hi,
In your outline, I am missing quite a few prerequisites which I mentioned (not sure if you have implemented them already)
your sub node, does it have singleton=false, cardinality 1..1 and selection cardinality 1..1?
The attribute of type TableCellDesign in that sub node, does it have the calculated property to true?
If you've bound each table column's cellDesign property to this calculated attribute, you just put some code in the generated generated get<SubNode><CalcAttribute> method to set the color
For instance by just entering the line
return WDTableCellDesign.CRITICALVALUE_LIGHT
in that method will render each linked cell to that color
Not sure what else I can say to explain this, there's not much to code...
Similar Messages
-
How to change the color of specific row in ALV tree
Hi,
I m using method set_table_for_first_display of a class CL_GUI_ALV_TREE.
The req is to change the color of specific row. Now can anybody tell me how to change the color of ALV tree. As in ALV tree and in this method 'set_table_for_first_display', there is no parameter IS_Layout.
Pls suggest...hi
hope this code will help you.
Reward if help.
REPORT zsharad_test1.
TABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
line_color(4) TYPE c, "Used to store row color attributes
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
Set layout field for row attributes(i.e. color)
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
FORM display_alv_report.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
TABLES
t_outtab = it_ekko
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
DATA: ld_color(1) TYPE c.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekko.
*Populate field with color attributes
LOOP AT it_ekko INTO wa_ekko.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
i.e. wa_ekko-line_color = 'C410'
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
IF ld_color = 8.
ld_color = 1.
ENDIF.
CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
wa_ekko-line_color = 'C410'.
MODIFY it_ekko FROM wa_ekko.
ENDLOOP.
ENDFORM. " DATA_RETRIEVAL -
How do I change the background color of a row in a table indicator?
Hello,
How do I change the background color of a row in a table indicator? I know how to change the background color in a active cell, but that is not what I want. My first intent is to make the background color of the first row a unique color, such as green, just to highlight the top row of the table.
Regards,
Kaspar
Regards,
KasparI have done this before by using a for loop to change the active cell of a row in order to give the appearance that the whole row is turning the color at once.
CLA, CLED, CTD,CPI, LabVIEW Champion
Platinum Alliance Partner
Senior Engineer
Using LV 2013, 2012
Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved. -
How to identify one specific row in the table STPO?
Hi!
How can I identify one specific row in the table STOP? As an input for my ABAP function I have MatNr, Plant, Alternative, BomUsage and Bom Position (0010, 0020...). With these values I can ask the table MAST to get the STLNR. But how can I get all needed values to specify an entry in the table STPO then?
Thanks,
KonradHere is a actual working code that we used here.
*-- get the bom details
li_mast-mandt = sy-mandt.
li_mast-matnr = material.
li_mast-werks = '6000'.
li_mast-stlan = '1'.
call function 'GET_MAST'
exporting
all = 'X'
no_buffer = 'X'
set = 'X'
tables
wa = li_mast
exceptions
call_invalid = 1
end_of_table = 2
get_without_set = 3
key_incomplete = 4
key_invalid = 5
no_record_found = 6
others = 7.
if sy-subrc <> 0.
clear: kdf_material,
kdf_material_desc.
exit.
endif.
loop at li_mast.
*-- get the valid headers
move-corresponding li_mast to li_stko.
li_stko-stlty = 'M'.
call function 'GET_STKO'
exporting
all = 'X'
datub = l_valid_date
datuv = l_valid_date
del = ' '
no_buffer = 'X'
set = 'X'
valid = 'X'
tables
wa = li_stko
exceptions
call_invalid = 1
end_of_table = 2
get_without_set = 3
key_incomplete = 4
key_invalid = 5
no_record_found = 6
others = 7.
if sy-subrc <> 0.
continue.
endif.
loop at li_stko.
move-corresponding li_stko to li_stpo.
call function 'GET_STPO'
exporting
all = 'X'
alter = li_stko-stlal
datub = l_valid_date
datuv = l_valid_date
no_buffer = 'X'
set = 'X'
valid = 'X'
* VIEWNAME =
tables
add_wa = li_cszalt
wa = li_stpo
exceptions
call_invalid = 1
end_of_table = 2
get_without_set = 3
key_incomplete = 4
key_invalid = 5
no_record_found = 6
viewname_invalid = 7
others = 8.
if sy-subrc <> 0.
continue.
else.
exit.
endif.
endloop.
if not li_stpo[] is initial.
exit.
endif.
endloop. -
How to color specific row in a table....
Hi all,
I created a table out of an Array[]. The table is successfully filled up by array's elements. Each element is a row.
I want to be able to color specific row; instead of every row. How do I do that?
I was looking rendering to color a row or a string; but not successfull.
Thank you for your time and assistence.My favorite way of doing this is to use CSS. You plan on giving the row you want colored an id attribute, then provide a style like this:
<style type="text/css">
tr#colorMe td {
background-color:blue;
</style>Then, when you want to color the row, you make the HTML output like this:
<table ...>
<tr> //normal row
<td></td><td></td><td></td>
</tr>
<tr id="colorMe"> //colored row
<td></td><td></td><td></td>
</tr>
<tr> //normal row
<td></td><td></td><td></td>
</tr>
</table> -
Color a specific row in ALV GRID display when user clicks on that row
hi
i have the entire code ready of how to check the line selected by the user and also to color that line but after settings those parameters
for to refresh the GRID so that the row apppears coloured .plz reply soon.... points will be awarded.....
wat i have done is
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = i_repid
i_callback_user_command = 'USER_COMMAND'
is_layout = it_layout
it_fieldcat = int_fieldcat
TABLES
t_outtab = int
EXCEPTIONS
program_error = 1
OTHERS = 2.
to display the GRID then when user clicks on any row this module gets called
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
READ TABLE int INDEX rs_selfield-tabindex.
int-rowcolor = 'C410'.
MODIFY int INDEX rs_selfield-tabindex TRANSPORTING rowcolor.
it_layout-info_fieldname = 'ROWCOLOR'.
then again i call 'REUSE_ALV_GRID_DISPLAY'
to display the GRID with the user selected line colored . the problem with this is when u go back from this screen u go to the previously displayed grid ....... whihc i dont want .....
ENDFORM. "user_commandHi,
By using following code,you can set the colors for each row,
Change this based on your requirement.
TABLES VBAK.
TYPE-POOLS SLIS.
Data Declaration
TYPES: BEGIN OF T_VBAK,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
ERNAM TYPE VBAK-ERNAM,
AUDAT TYPE VBAK-AUDAT,
VBTYP TYPE VBAK-VBTYP,
NETWR TYPE VBAK-NETWR,
VKORG TYPE VBAK-VKORG,
VKGRP TYPE VBAK-VKGRP,
LINE_COLOR(4) TYPE C,
END OF T_VBAK.
DATA: IT_VBAK TYPE STANDARD TABLE OF T_VBAK INITIAL SIZE 0,
WA_VBAK TYPE T_VBAK.
ALV Data Declaration
DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
GD_REPID TYPE SY-REPID.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BLD_FLDCAT.
PERFORM BLD_LAYOUT.
PERFORM DISPLAY_ALV_REPORT.
Build Field Catalog for ALV Report
FORM BLD_FLDCAT.
FLDCAT-FIELDNAME = 'VBELN'.
FLDCAT-SELTEXT_M = 'Sales Document'.
FLDCAT-COL_POS = 0.
*FLDCAT-EMPHASIZE = 'C411'.
FLDCAT-OUTPUTLEN = 20.
FLDCAT-KEY = 'X'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'ERDAT'.
FLDCAT-SELTEXT_L = 'Record Date created'.
FLDCAT-COL_POS = 1.
FLDCAT-KEY = 'X'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'ERNAM'.
FLDCAT-SELTEXT_L = 'Cteated Object Person Name'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'AUDAT'.
FLDCAT-SELTEXT_M = 'Document Date'.
FLDCAT-COL_POS = 3.
FLDCAT-EMPHASIZE = 'C110'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'VBTYP'.
FLDCAT-SELTEXT_L = 'SD Document category'.
FLDCAT-COL_POS = 4.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'NETWR'.
FLDCAT-SELTEXT_L = 'Net Value of the SO in Document Currency'.
FLDCAT-COL_POS = 5.
FLDCAT-OUTPUTLEN = 60.
FLDCAT-DO_SUM = 'X'.
FLDCAT-DATATYPE = 'CURR'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'VKORG'.
FLDCAT-SELTEXT_L = 'Sales Organization'.
FLDCAT-COL_POS = 6.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'VKGRP'.
FLDCAT-SELTEXT_M = 'Sales Group'.
FLDCAT-COL_POS = 7.
FLDCAT-EMPHASIZE = 'C801'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
ENDFORM.
Build Layout for ALV Grid Report
FORM BLD_LAYOUT.
GD_LAYOUT-NO_INPUT = 'X'.
GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GD_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
GD_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.
GD_LAYOUT-CONFIRMATION_PROMPT = 'X'. This asks the confirmation before leaving the screen.
ENDFORM.
Display report using ALV grid
FORM DISPLAY_ALV_REPORT.
GD_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
IS_LAYOUT = GD_LAYOUT
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = 'SALES DOCUMENT HEADER'
IT_FIELDCAT = FLDCAT[]
I_SAVE = 'X'
TABLES
T_OUTTAB = IT_VBAK
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
Retrieve data from VBAK table and populate itab IT_VBAK
FORM DATA_RETRIEVAL.
DATA LD_COLOR(1) TYPE C.
SELECT VBELN ERDAT ERNAM AUDAT VBTYP NETWR VKORG
UP TO 20 ROWS
FROM VBAK
INTO TABLE IT_VBAK.
LOOP AT IT_VBAK INTO WA_VBAK.
LD_COLOR = LD_COLOR + 1.
IF LD_COLOR = 8.
LD_COLOR = 1.
ENDIF.
CONCATENATE 'C' LD_COLOR '10' INTO WA_VBAK-LINE_COLOR.
MODIFY IT_VBAK FROM WA_VBAK.
ENDLOOP.
ENDFORM.
FORM TOP_OF_PAGE.
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
W_HEADER TYPE SLIS_LISTHEADER.
W_HEADER-TYP = 'H'.
W_HEADER-INFO = 'WELCOME HEADER LIST'.
APPEND W_HEADER TO T_HEADER.
W_HEADER-TYP = 'S'.
W_HEADER-KEY = 'REPORT:'.
W_HEADER-INFO = SY-REPID.
APPEND W_HEADER TO T_HEADER.
W_HEADER-TYP = 'S'.
W_HEADER-KEY = 'DATE:'.
CONCATENATE SY-DATUM6(2) ' / ' SY-DATUM4(2) ' / ' SY-DATUM(4) INTO W_HEADER-INFO.
APPEND W_HEADER TO T_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER
ENDFORM.
Reward points,if it is useful.
Thanks,
chandu. -
Change the background color of selected row in adf table
Hi,
Can somebody guide me in changing the background color of a row when its being selected. In my ADF table, one of the column is of type Command Link. So whenever i click this command link on any particular row that complete row color should change as an indication of that row being selected.
Please guide me to do this. I referred to other forum posts, but they couldnt meet my need.
Thanks
riHi Frank,
you're right. This should work. But the result is not perfect from my point of view.
I use
<af:table ...>
<af:column ...>
<af:outputText value="#{row.col1}" inlineStyle="#{row.mystyle}"/>
</af:column>
</af:table>and I get e.g. this in HTML:
<table ...>
<tr>
<td class="af_column_cell-text OraTableBorder1111"><span style="font-weight:bold;">qqq</span></td>
</tr>
</table>while I would prefer to get somethig like this:
<table ...>
<tr>
<td style="font-weight:bold;"><span>qqq</span></td>
</tr>
</table>, which looks much smarter. Is it possible?
Thanks,
Alexandre. -
How to apply different colors to specific rows in JTable
hi,
Anybody could tell me the way of colorising the rows in jtable.. I want to apply different colors to diff rows..
If i get a piece of code that could help me a lot..
thanks in advance,
Sapnayou'll find the answer at http://www2.gol.com/users/tame/swing/examples/SwingExamples.html
-
Getting values from a specific row in a table
hi all, i have a table that has the following data
WITH sec AS
SELECT 111 id, 'XPE' cid, 10 alias, 'TLC' Description, 'PEYU' lvl_1, 'IES' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 111 id, 'XPE' cid, 78 alias, 'TLC2' Description, 'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 111 id, 'XPE' cid, 200 alias, 'TLC' Description, null lvl_1, null lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 111 id, 'XPE' cid, 54 alias, 'TLC3' Description, 'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 112 id, 'XPE2' cid, 10 alias, 'PAD' Description, 'PEYU' lvl_1, 'IES' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 112 id, 'XPE2' cid, 78 alias, 'PAD2' Description, 'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 112 id, 'XPE2' cid, 54 alias, 'TLC3' Description, 'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 112 id, 'XPE2' cid, 200 alias, 'PAD' Description, 'SIN' lvl_1, 'CON' lvl_2, ' UIE' lvl_3 FROM dual UNION ALL
SELECT 113 id, 'XPE3' cid, 10 alias, 'PAD5' Description, NULL lvl_1, NULL lvl_2, NULL lvl_3 FROM dual UNION ALL
SELECT 113 id, 'XPE3' cid, 200 alias, 'PAD5' Description, NULL lvl_1, NULL lvl_2, NULL lvl_3 FROM dual UNION ALL
SELECT 113 id, 'XPE3' cid, 78 alias, 'PAD7' Description, 'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 113 id, 'XPE3' cid, 54 alias, 'TLE' Description, 'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual
)i want to write a query that give me this output
ID CID ALIAS DESCRIPTION LVL_1 LVL_2 LVL_3
111 XPE 10 TLC PEYU IES BAN
111 XPE 200 TLC PEYU IES BAN
111 XPE 78 TLC2 SUN BAN3
111 XPE 54 TLC3 SUN5 BAN3
112 XPE2 10 PAD PEYU IES BAN
112 XPE2 200 PAD SIN CON UIE
112 XPE2 78 PAD2 SUN BAN3
112 XPE2 54 TLC3 SUN5 BAN3
113 XPE3 10 PAD5
113 XPE3 200 PAD5
113 XPE3 78 PAD7 SUN BAN3
113 XPE3 54 TLE SUN5 BAN3
this is how the logic works:
as you can see the table has many different set of ids, 111,112,113 and each id has a set of alias
for id 111 and alias 200 the sec table has null values for level 1 and level 2 columns. what i want to do
is that if any of the level1,level2 and level3 columns has null VALUES(FOR aliases=200) then the values should be taking from the ROW(s) with alias=10
in this case alias=200 display peyu and ies for level1 and level2 column. this values were taking from the row with alias=10 and id =111.
level3 stay the same since it is not null
for id 112 and alias =200, none of te level columns has null so the value stay the same as in the table
for id 113 alias 200, all level columns has null so the value should be taking from alias=10 id =113.
in this case the row with alias=10 has also null so both rows 200 and 10 gets display with null values
the other rows with different alias should just be display.
i tried using las_value analytic function but i was not successful. i am using ORACLE 9I and ignore null option in last_value function is not supported
the data in the table is not in any particular order.
can someone help write a query that gives me the output above. thanksIf I understand correct,below solution is corect. :-)
col lvl_2 for a10
WITH sec AS(
SELECT 111 id, 10 alias,'PEYU' lvl_1, 'IES' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 111 id, 78 alias,'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 111 id,200 alias,null lvl_1, null lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 111 id, 54 alias,'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 112 id, 10 alias,'PEYU' lvl_1, 'IES' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 112 id, 78 alias,'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 112 id, 54 alias,'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 112 id,200 alias,'SIN' lvl_1, 'CON' lvl_2, ' UIE' lvl_3 FROM dual UNION ALL
SELECT 113 id, 10 alias, NULL lvl_1, NULL lvl_2, NULL lvl_3 FROM dual UNION ALL
SELECT 113 id,200 alias, NULL lvl_1, NULL lvl_2, NULL lvl_3 FROM dual UNION ALL
SELECT 113 id, 78 alias,'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 113 id, 54 alias,'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual
select id,alias,
case when alias = 200 and lvl_1 is null
then max(decode(alias,10,lvl_1)) over(partition by id)
else lvl_1 end as lvl_1,
case when alias = 200 and lvl_2 is null
then max(decode(alias,10,lvl_2)) over(partition by id)
else lvl_2 end as lvl_2,
case when alias = 200 and lvl_3 is null
then max(decode(alias,10,lvl_3)) over(partition by id)
else lvl_3 end as lvl_3
from sec
order by id,alias;
ID ALIAS LVL_ LVL_2 LVL_3
111 10 PEYU IES BAN
111 54 SUN5 null BAN3
111 78 SUN null BAN3
111 200 PEYU IES BAN
112 10 PEYU IES BAN
112 54 SUN5 null BAN3
112 78 SUN null BAN3
112 200 SIN CON UIE
113 10 null null null
113 54 SUN5 null BAN3
113 78 SUN null BAN3
113 200 null null null -
How to change the semantic color of entire rows in a table.
Hi, in the past I already managed to change the semantic color of a cell by a condition (for example all the cells with negative number -> I set negative semantic color)
My question is how can I change the semantic color of the entire row where this cell belong, and not only the cell. Im using NW2004.
BTW, Im not a java programmer, neither a Webdynpro expert, just an ABAP Programmer. So try to be very explicit, Thx.Rodrigo,
You can just bind correspondign property of every cell editor (TextView) of every column to the very same context attribute. Next, when you change attribute value for certain elemnt, the whole row (every cell editor in row) will get same value.
Valery Silaev
SaM Solutions
http://www.sam-solutions.net -
Generic function to display a specific row from any table
Hi all,
I need some help to write a function in PL/SQL or Dynamic SQL (or both), to write a function that would take in parameters only the unique ID of the row to display and the name of the table to display (that could be any table with any format).
Actually we don't know in advance which table will be accessed, so we don't know the columns and their types until the function is called.
Once I get the row, I want to return a small table with a size of only one line containing the details of the row I looked for.
So the signature of the function would be something like: CREATE function displayDetailedRowFromAnyTable(uniqId in varchar2(25), tableName in varchar2(25)).
Hope the description is clear. I found in some forums some details about this kind of problems; however, the structure of the tables (ie. the columns name and their types) is always known in advance. In my case, I don't know those details until run time.
Any help would be greatly appreciated.There is a built in "function" to do this. It's called "SELECT" and it's available through the SQL engine. You give it the table name and the ID you want and it can return you all the columns from that table...
e.g.
SELECT *
FROM <table_name>
WHERE id = <required_id>If you truly want a generic dynamic SQL then you'll have to code it as an ANYTYPE (as already mentioned above). Although this will make your code very complex and difficult to maintain.
e.g. of defining your own dynamic pipelined function using anytype ...
create or replace type NColPipe as object
l_parm varchar2(10), -- The parameter given to the table function
rows_requested number, -- The parameter given to the table function
ret_type anytype, -- The return type of the table function
rows_returned number, -- The number of rows currently returned by the table function
static function ODCITableDescribe( rtype out anytype, p_parm in varchar2, p_rows_req in number := 1 )
return number,
static function ODCITablePrepare( sctx out NColPipe, ti in sys.ODCITabFuncInfo, p_parm in varchar2, p_rows_req in number := 1 )
return number,
static function ODCITableStart( sctx in out NColPipe, p_parm in varchar2, p_rows_req in number := 1 )
return number,
member function ODCITableFetch( self in out NColPipe, nrows in number, outset out anydataset )
return number,
member function ODCITableClose( self in NColPipe )
return number,
static function show( p_parm in varchar2, p_rows_req in number := 1 )
return anydataset pipelined using NColPipe
create or replace type body NColPipe as
static function ODCITableDescribe( rtype out anytype, p_parm in varchar2, p_rows_req in number := 1 )
return number
is
atyp anytype;
begin
anytype.begincreate( dbms_types.typecode_object, atyp );
atyp.addattr( to_char(to_date(p_parm,'MONYYYY'),'MONYY')
, dbms_types.typecode_varchar2
, null
, null
, 10
, null
, null
atyp.endcreate;
anytype.begincreate( dbms_types.typecode_table, rtype );
rtype.SetInfo( null, null, null, null, null, atyp, dbms_types.typecode_object, 0 );
rtype.endcreate();
return odciconst.success;
exception
when others then
return odciconst.error;
end;
static function ODCITablePrepare( sctx out NColPipe, ti in sys.ODCITabFuncInfo, p_parm in varchar2, p_rows_req in number := 1 )
return number
is
elem_typ sys.anytype;
prec pls_integer;
scale pls_integer;
len pls_integer;
csid pls_integer;
csfrm pls_integer;
tc pls_integer;
aname varchar2(30);
begin
tc := ti.RetType.GetAttrElemInfo( 1, prec, scale, len, csid, csfrm, elem_typ, aname );
sctx := NColPipe( p_parm, p_rows_req, elem_typ, 0 );
return odciconst.success;
end;
static function ODCITableStart( sctx in out NColPipe, p_parm in varchar2, p_rows_req in number := 1 )
return number
is
begin
return odciconst.success;
end;
member function ODCITableFetch( self in out NColPipe, nrows in number, outset out anydataset )
return number
is
begin
anydataset.begincreate( dbms_types.typecode_object, self.ret_type, outset );
for i in self.rows_returned + 1 .. self.rows_requested
loop
outset.addinstance;
outset.piecewise();
outset.setvarchar2( self.l_parm );
self.rows_returned := self.rows_returned + 1;
end loop;
outset.endcreate;
return odciconst.success;
end;
member function ODCITableClose( self in NColPipe )
return number
is
begin
return odciconst.success;
end;
end;
And to use it
SQL> select * from table( NColPipe.show( 'JAN2008' ) );
JAN08
JAN2008 -
Hi,
I have a table (on a custom page) that includes MessageStyledText columns and a MessageCheckBox column, I would like to set the MessageCheckBox to Read Only if the value of the MessageStyledText column on the row is ‘XYZ’, could someone give me some pointers on how this can be achieved?
Oracle EBS: 12.1.3
JDEV: 10.1.3.3.0.3
Kind Regards
CarlSorted it using SPEL (as per https://forums.oracle.com/message/1815932#1815932).
-
How can I color just one row in a table?
Hello,
I'm implementing cut/copy/paste and I want that when I perform cut the row color will be pale/ghost than the regular selectionRow background. And I want this pale color to stay for this row regardless if I select now other rows. I need it for JTable, JTree & JList. So my question is how can I color a row in those components (permanently - till I release it)
Thanks
Bnaya.Hi,
for a JTable I would suggest the following:
1.in the body of the class
int ghostrow = -1;
Color ghostColor = Color.lightGray; // for example2. overwrite the prepareRenderer-method this way
public Component prepareRenderer(TableCellRenderer render,int row, int column) {
Component c = super.prepareRenderer(renderer,row,column);
if (row==ghostrow) c.setBackground(ghostColor);
return c;
}3. add a method in your JTable subclass for setting of the ghostrow like this, in order to force the JTable to update its display after setting ghostrow
public void setGhostRow(int row) {
TableModel tm = getModel();
int currow = tm.getRowCount();
int oldrow = ghostrow;
ghostrow = -1;
if (row<currow) ghostrow = row;
// next 2 rows in normal mode displayed, because it will not print the greater than symbol correctif ((oldrow>-1) && (oldrow<currow)) tableChanged(new TableModelEvent(tm,oldrow));
if ((ghostrow>-1) && (ghostrow<currow)) tableChanged(new TableModelEvent(tm,ghostrow));
For the other classes, you want this effect to happen in, try to find a similar method, that is central and do it in a similar way there.
greetings Marsian -
How to determine specific row in table clicked on
Hello -
I need to determine the specific row of a table control that is right-mouse-clicked on. I think this is only possible by using the Shortcut Menu Activation? event for the table control and obtaining the vertical coordinate in the Coords filter options.
This entails performing experiments to determine the vertical range of each row in the table, or perhaps by determining the width of one row and using a linear relationship to determine the possible range of subsequent rows. Do you feel this is the best strategy or is there possibly another easier way to obtain this information?
Thanks,
Don
Solved!
Go to Solution.Pop up on the Table and CREATE INVOKE NODE for POINT TO ROW COLUMN.
Place that node on your diagram.
Feed the COORDS cluster to that node, and out comes the row and column you clicked on.
Be careful of edge cases, I don't remnember exactly, but if you have scroll bars visible, you might have to take them into account. Use the IN BOUNDS output
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com
Blog for (mostly LabVIEW) programmers: Tips And Tricks -
Colouring Rows of a Table depending on a particular condition.
Hi,
The problem I am facing is coloring specific rows of a table depending on the satisfaction of a particular condtion. For example: All rows having the value in the amount column greater than 1000 have to be coloured in red and the remaining yellow.
Can anyone please help me out with this row-coloring problem?
Regards,
Gaurav.Hi Martin,
Have used an image column to display image.
You can define the condition in the URL field, to display the image. Something like:
=IF(@img=="50",store@IMAGE_URL&"Green_dot.png",IF(@img=="40",store@IMAGE_URL&"Yellow_dot.png",IF(@img=="39",store@IMAGE_URL&"Red_dot.png","")))
Where store@IMAGE_URL has the URL to the location where the images are stored.
Let me if it helps.
Regards,
Dharmi
Maybe you are looking for
-
Unity Issue in leaving message
Hi Guys, i have a problem with unity connection 8.5 I configured one users with voice mail box. I performed registration by entering name,pin...etc When i call and forwarded to voice mail system prompt me to leave a mmessage but when i leave message
-
New line item insertion in delivery via EDI - PI
hi, the requirement is to insert a new line item in the delivery. This new line item inserted should be done via an IDOC, which while entering the SAP will insert a new line item in the delivery. The question if this line item insertion should be don
-
WL Cluster: install of weblogic is not working properly
Cluster install of weblogic is not working properly. We are getting kicked out every now and then from the portal when both PIA1 and PIA2 nodes are up. When we shut down one meaning switch off clustering then we are fine(Portal becomes very stable).
-
'Time Our Error while executing some BW reports.'
Hello BW experts , We are getting the 'Time Our Error while executing some BW reports.' Could anyone help us to solve the above issue. regards, Amol.
-
Can't open JPGs into ACR from Bridge - Windows XP
I was using CS3 on a Windows XP Machine, just installed the latest updates from adobe (to 2.0.0.10 I believe) and can no longer open JPGs in Camera Raw by hitting CTRL-R. I already tried uninstalling and reinstalling all the adobe suite, (back to 2.0