Select rows based on condition of same row
Hello,
I have the following table structure and rows defind here
http://sqlfiddle.com/#!4/3f474/3
I would like to select rows if PRODUCT_NO is null then I need to select rows which are having IS_PAYABLE='Y'. If PRODUCT_NO is not null
then IS_PAYABLE will be 'N' or IS_PAYABLE will be null.
E.g.
For PRODUCT_REG HPO_FABRIC, one PRODUCT_NO null so I need select that row only, not the other two rows.
I can do
select * from SUPPLIER_DETAILS where IS_PAYABLE='Y', but what if there are many records with PRODUCT_NO having null or not null
How can I do this using sql?
This simple query!!!
select *
from supplier_details
where (product_no is null
and is_payable = 'Y')
or (product_no is not null and is_payable is null);
PRODUCT_REG PRODUCT_SUPPLIER_CODE PRODUCT_NO START_DATE END_DATE IS_PAYABLE
HPO_FABRIC JP_008 01-AUG-01 31-AUG-01 Y
HPO_FABRIC JP_008 STGA-FABR1 16-AUG-01 31-AUG-01 --Edited:- Modified Query and Results for 2nd Requirement
Edited by: Purvesh K on Sep 17, 2012 4:55 PM
--Removed NVL
Edited by: Purvesh K on Sep 17, 2012 5:04 PM
Similar Messages
-
Table Control - Input Enabling/Diabling of Rows based on Condition.
Hi,
In the TC, I want to Input Enable/Disable the rows based on Conditions. The First row is input enabled always. But the other rows, (2nd onwards) need to be Input Enabled/Disabled based on some conditions. It is possible to make this working. Can you please provide me a suitable solution for this?
Appreciate Your Help.
Thanks,
KannanHi Kannan...
If we are talking about "Rows"...
then identify based on some conditions the row numbers and in PBO...loop at screen with screen name..set thier input properties and modify screen (make them input only)
If we are taking into consideration "columns"
There is an internal structure COLS where we can identify column number of screen name ...or we can take except for one particular column..
if some condition satisfied....
loop at screen where screen-name <> "Column which is input'.
Loop at screen...and make other columns display only.
modify screen
endif.
Regards
Byju -
Adding rows based on current and next row
I got some excellent help on multiplying rows based on start and end date in this
thread, resulting in the query below. It helps me follow Vehicle activity and Vehicle allocation of our vehicles day by day. Now I would like to add another feature to the query, if it is possible.
The problem is that in our database, only actual tasks are registered, which means that the time when the vehicle is between tasks is not showing. I could of course calculate total available time per vehicle and month, but that would not tell me where the
vehicles are waiting, when during the day, etc.
So I would like to insert rows for when the vehicles are standing still, and the logic would be something like this:
If vehicle number on current row equals vehicle number on the next row and End (date/time) of current row < Start (date/time) of next row, insert row after current row. Set Start=End of current row and End=Start of next row. Set From=To
of current row and To=To of current row. Set Vehicle activity to "Not active". Finaly copy all other fields from current row.
Is this possible to achieve in Power Query?
Brgds,
Caj
let
Source = Sql.Databases("sql10"),
SLM = Source{[Name="SLM"]}[Data],
dbo_V_LKPI = SLM{[Schema="dbo",Item="V_LKPI"]}[Data],
RenamedColumns = Table.RenameColumns(dbo_V_LKPI,{{"ActualDeparture", "Start"}, {"ActualArrival", "End"}}),
Records = Table.ToRecords(V_LocoKPI),
DateTime.IsSameDay = (x, y) => Date.Year(x) = Date.Year(y) and Date.Month(x) = Date.Month(y) and Date.Day(x) = Date.Day(y),
Expand = (x) => List.Generate(
() => Record.Combine({x, [End=Date.EndOfDay(x[Start])]}),
(record) => record[Start] <= x[End],
(record) => let
NextStart = Date.StartOfDay(Date.AddDays(record[Start], 1)),
NextEnd = Date.EndOfDay(NextStart),
ThisEnd = List.Min({NextEnd, x[End]})
in
Record.Combine({record, [Start=NextStart, End=ThisEnd]})),
Transformed = List.Transform(Records, each if DateTime.IsSameDay([Start], [End]) then {_} else Expand(_)),
Combined = List.Combine(Transformed),
Result = Table.FromRecords(Combined)
in
Result
CstenHere's some sample code. Again, we use List.Generate to build either a record or a list of records and then use List.Combine to bring the results back together before converting them to a table.
let
CombineTwoRows = (x, y) =>
let
combine = x[Vehicle] = y[Vehicle] and x[End] < y[Start],
added = Record.Combine({x, [Start=x[End], End=y[Start], Active=false]}),
result = if combine then {added, y} else {y}
in result,
GenerateStandingRows = (table, combine) =>
let
Handle = (x, y) => {x, y},
buffered = Table.Buffer(table),
n = Table.RowCount(buffered),
windows = List.Generate(
() => {1, {buffered{0}}},
(x) => x{0} <= n,
(x) => {x{0} + 1, if x{0} < n then combine(buffered{x{0}-1}, buffered{x{0}}) else {buffered{x{0}}}},
(x) => x{1})
in
windows,
InsertInactivity = (table) => Table.FromRecords(List.Combine(GenerateStandingRows(table, CombineTwoRows))),
TestData = Table.FromRows({
{1, #datetime(2014, 2, 23, 13, 0, 0), #datetime(2014, 2, 23, 13, 10, 0), true},
{1, #datetime(2014, 2, 23, 13, 20, 0), #datetime(2014, 2, 23, 13, 30, 0), true},
{2, #datetime(2014, 2, 23, 13, 20, 0), #datetime(2014, 2, 23, 14, 0, 0), true},
{2, #datetime(2014, 2, 23, 14, 20, 0), #datetime(2014, 2, 23, 14, 40, 0), true},
{2, #datetime(2014, 2, 23, 16, 0, 0), #datetime(2014, 2, 23, 17, 0, 0), true},
{2, #datetime(2014, 2, 24, 2, 0, 0), #datetime(2014, 2, 24, 3, 0, 0), true},
{3, #datetime(2014, 2, 24, 1, 0, 0), #datetime(2014, 2, 24, 8, 0, 0), true},
{3, #datetime(2014, 2, 24, 9, 0, 0), #datetime(2014, 2, 24, 10, 0, 0), true}
}, {"Vehicle", "Start", "End", "Active"})
in
InsertInactivity(TestData) -
Duplicate rows based upon condition
Oracle 11.2.0.1
Windows
create table regsales (billno number,itemno number,paymode varchar2(10));
insert into regsales values (12345,10,'cash');
insert into regsales values (12345,11,'cash');
insert into regsales values (12346,11,'cash');
insert into regsales values (12347,10,'credit');
insert into regsales values (12348,14,'cash');
insert into regsales values (12348,15,'cash');
insert into regsales values (12345,12,'cash');
insert into regsales values (12349,10,'cash');
insert into regsales values (12345,10,'credit');
insert into regsales values (12350,11,'cash');
insert into regsales values (12351,12,'cash');
insert into regsales values (12352,11,'cash');
insert into regsales values (12350,11,'credit');
Required Output please :
BILLNO ITEMNO PAYMODE
12345 11 cash
12345 11 credit
12350 10 cash
12350 10 credit
i.e. in which same billnos same itemno has been sold in cash and credit.
Thank you.Hi,
So, you need to know how many different paymodes there are in a group of rows. That sounds like a job for COUNT (DISTINCT ...)
Here's one way:
WITH got_cnt AS
SELECT billno, itemno, paymode
, COUNT (DISTINCT paymode)
OVER ( PARTITION BY billno
, itemno
) AS cnt
FROM regsales
SELECT billno, itemno, paymode
FROM got_cnt
WHERE cnt = 2
ORDER BY billno, itemno, paymode
Can there be other paymodes besides 'cash' and 'credit'? If so, the same basic idea will still work, but the details may be a little messier, depending on your requirements. -
Planning Form: Suppress row based on condition
Dear All,
Is it possible to do this in hyperion planning. for example:
- i have member A
- in the data form, i want to show row only when member A have value equal to 1. other is suppressed.
- in another form, i want to show only when A = 2, other is suppresed.
did anybody have this experience, or is there any other way to do this?
Thanks in advance.
Regards,
FeriHi, i assumed as answered because in fact, the Planning dataform don't have that functionality, but in the new version (11.1.2.2) you might want to try the filter functionality.
It was a long time ago, but if i'm not mistaken, previously i solve this problem by separating the member for each condition.
example:
member A: have all data
(copy the data from member A to member B and C with condition)
member B: contain data for condition 1
member C: contain data for condition 2
then you can select which condition that you need to show. -
Add different UI in each row based on conditions in ALV
Hell All,
i am working on dynamic ALV in which i have created 3 methods 1. which creates the columns 2. Which sets the data into teh created columns. 3. which does teh alv customizations.
So now my requirement is based on some condition i want to change the UI element
eg
i have
column1 column2 column3
1 link_to_action name
2 link_to_url name2
so based on the condition i would like to display the ui elements as above.
I was able to do till this end so far..
1.in create_columns method i created a column call cell_varaint
2 when i was passing data into the columns
'when column1'
IF colum1 = 1.
<field> = 'link_to_url'
else.
<f_field> = ' '.
endif.
when 'column2'
CREATE OBJECT lr_link_to_actn.
<ls_column>-r_column->set_cell_editor( lr_link_to_actn ).
CREATE OBJECT l_cv.
l_cv->set_key( value = 'LINK_TO_URL').
l_cv->set_editor( value = lr_lnk_to_url ).
<ls_column>-r_column->add_cell_variant( r_cell_variant = l_cv ).
<ls_column>-r_column->set_sel_cell_variant_fieldname( 'cell_varaint).
so now i am able to get only empty column with no data into it ... and my cell varaint column shows me the values like LINK_to_URL or space.
I am sure tht some where i am missing something...
Please tell me the correct procedure to use it...
Regards,
Sana.I hope it is Hello not Hell
if i understand your question correctly, You want the first row of column to LinkToAction UI element and second row LinktoURL.
follow the link where it is nicely explained however he is making one row as text view and other as checkbox.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0e7461d-5e6c-2b10-dda9-9e99df4d136d?quicklink=index&overridelayout=true -
Color the row based on condition
Hello all,
I am woring on an interactive adobe form being called by a web dynpro application.
The adobe form interface used is XML Schema based. The form displays some data at header level and item level.
The item details are displayed in a table. Now. my requirement is that i have a field 'STATUS' in the item table. I want to display the row with RED color if the STATUS = 'X' . How can i achieve this.. i tried using java script at Row initialze event but that didn' work.
Please let me know if you have some solutions.
Thanks & Regards,
Ravi AswaniTry this code
var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);
var custordertext;
for (var i=0; i <= fields.length-1; i++)
if (fields.item(i).name == "STATUS")
if(fields.item(i).rawValue == "X")
this.fillColor = "50, 50, 255";
use this event in calculate event
Thanks,
Rakesh -
SELECT TABLE BASED ON CONDITION
hi every one , i need your help in resolving this issue . if you look at the last column service_id in the select the value of the service_id is derived from by the source_system.
each source system can have 1 to multiple service_ids . the below query returns same data set with different service_ids. my question is
for example when source_system is 'COMS' the i have included table ref_coms_circuit to get multiple service ids. so if i have to include another source_system 'ESP' then how will i do that.
WITH t AS
(SELECT so.tin, so.o_seq, so.order_type,
so.customer_req_due_date customer_due_date,
MAX (soplm1.milestone_date) order_date,
MAX (soplm2.milestone_date) hold_begin_date,
MAX (soplm3.milestone_date) hold_end_date
FROM s_order so,
s_order_product_leg_milestone soplm,
s_order_product_leg_milestone soplm1,
s_order_product_leg_milestone soplm2,
s_order_product_leg_milestone soplm3
WHERE -- so.order_status = 'A' AND
so.contract_id IN ('157798', '157800')
-- AND soplm.milestone_id = 4350
AND soplm.source_system_name = 'OPRO'
AND soplm.o_seq = so.o_seq
AND soplm.last_modified_date >=
TO_DATE ('07/01/2007 00 :00:00', ' MM/DD/YYYY HH24: MI: SS')
AND soplm.last_modified_date < SYSDATE
AND soplm.tin = 'OPRO.670148'
AND soplm1.tin(+) = so.tin
AND soplm1.o_seq(+) = so.o_seq
AND so.tin = soplm2.tin(+)
AND so.tin = soplm3.tin(+)
AND so.o_seq = soplm2.o_seq(+)
AND so.o_seq = soplm3.o_seq(+)
AND soplm1.milestone_id(+) = 100
AND soplm1.source_system_name(+) = 'OPRO'
AND soplm2.milestone_id(+) = 1650
AND soplm2.source_system_name(+) = 'NPRO'
AND soplm3.milestone_id(+) = 1690
AND soplm3.source_system_name(+) = 'NPRO'
GROUP BY so.tin, so.o_seq, so.order_type, so.customer_req_due_date)
SELECT DISTINCT soplm4.tin, soplm4.VERSION, soplm4.product_serial_number,
soplm4.node_id, t.order_type, sopl.product_id,
rp.product_id_desc product_desc, NULL AS product_catalog_id,
soplm4.source_system_name, t.order_date, t.customer_due_date,
NULL AS asrn, NULL AS service_typ_seq, t.hold_begin_date,
t.hold_end_date,
DECODE (soplm4.source_system_name,
'COMS', 'COMS CIRCUIT ID',
'FE', 'FE CIRCUIT ID',
'VDDS', 'PVC ID',
'ESP', 'ESP Product Billing Key',
'OTS', 'OTS SITE ID',
'UCLP', 'K - Number',
'NCAP', 'NETCAP 800# ',
'IASA', 'IASA ANI ',
'COMP', 'COMMONPLACE AUTH CODE',
soplm4.source_system_name
) neid_type,
CASE soplm4.source_system_name
WHEN 'COMS'
THEN rcc.circuit_number
WHEN 'VDDS'
THEN sopl.pvc_id
WHEN 'OTS'
THEN sopl.site
WHEN 'IASA'
THEN sopl.iasa_account_id
WHEN 'COMP'
THEN sopl.pin
WHEN 'UCLP'
THEN sopl.billing_identifier
WHEN 'NCAP'
THEN sopl.toll_free_num
-- WHEN 'ESP' THEN soed.product_billing_key
-- WHEN 'FE' THEN
ELSE NULL
END service_id
FROM t,
s_order_product sop,
s_order_product_leg sopl,
s_order_product_leg_milestone soplm4,
ref_product rp,
ref_coms_circuit rcc
WHERE soplm4.tin = t.tin
AND soplm4.o_seq = t.o_seq
AND soplm4.source_system_name IN (SELECT source_system_name
FROM com_calnet_systems)
AND sop.tin = t.tin
AND sop.o_seq = t.o_seq
AND sopl.tin = t.tin
AND sop.op_seq = soplm4.op_seq
AND sopl.o_seq = t.o_seq
AND sopl.opl_seq = soplm4.opl_seq
AND rp.product_id = sopl.product_id
AND rcc.coms_service_number = sop.coms_service_number;Either union all of them before or after the join, i.e.,
Solution 1:
SELECT DISTINCT soplm4.tin, soplm4.VERSION, soplm4.product_serial_number,
FROM t,
ref_coms_circuit rcc
WHERE soplm4.tin = t.tin
AND rcc.coms_service_number = sop.coms_service_number
union all
SELECT DISTINCT soplm4.tin, soplm4.VERSION, soplm4.product_serial_number,
FROM t,
ref_vdds_circuit rvc
WHERE soplm4.tin = t.tin
AND rvc.coms_service_number = sop.coms_service_number
union all
SELECT DISTINCT soplm4.tin, soplm4.VERSION, soplm4.product_serial_number,
...Solution 2:
SELECT DISTINCT soplm4.tin, soplm4.VERSION, soplm4.product_serial_number,
FROM t,
(select 'COMS' source, circuit_number data, coms_service_number
-- any column you need in your output
from ref_coms_circuit
union all
select 'VDDS', pvc_id, coms_service_number
-- any column you need in your output
from ref_vdds_circuit
union all...) bigunion
WHERE soplm4.tin = t.tin
AND soplm4.source_system_name = bigunion.source
AND rcc.coms_service_number = sop.coms_service_number;Edited by: thtsang on Oct 20, 2009 10:28 PM
Edited by: thtsang on Oct 20, 2009 10:44 PM -
Display input field on selection screen based on condition
Hi,
I have a report with selection with no of input fields and a checkbox .I want to hide few i/p fileds based on checkbox i/p.
If the checkbox = 'X',then only those fields should apper on screen for input.
how do we get this on sel screen.
thanks in advance.Hi,
you can use this code as reference.
Here, depens on check box, in the next screen resepective select options will be displayed.
You can use this logic for your requirement.
REPORT Z50871_SELECTOPS_DYNAMIC.
PARAMETERS : CH_EBELN AS CHECKBOX,
CH_VBELN AS CHECKBOX.
DATA: V_EBELN TYPE EKKO-EBELN,
V_VBELN TYPE VBAK-VBELN.
SELECTION-SCREEN BEGIN OF SCREEN 100.
SELECT-OPTIONS : EBELN FOR V_EBELN MODIF ID G1,
VBELN FOR V_VBELN MODIF ID G2.
SELECTION-SCREEN END OF SCREEN 100 .
AT SELECTION-SCREEN OUTPUT.
IF SY-DYNNR = 100.
IF CH_EBELN = 'X' AND
CH_VBELN = ''.
LOOP AT SCREEN.
IF SCREEN-GROUP1 EQ 'G1'.
SCREEN-ACTIVE = '1'.
ELSE.
SCREEN-ACTIVE = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF CH_VBELN = 'X' AND
CH_EBELN = '' .
LOOP AT SCREEN.
IF SCREEN-GROUP1 EQ 'G2'.
SCREEN-ACTIVE = '1'.
ELSE.
SCREEN-ACTIVE = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF CH_EBELN = 'X' AND CH_VBELN = 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 EQ 'G1'
OR SCREEN-GROUP1 EQ 'G2' .
SCREEN-ACTIVE = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDIF.
AT SELECTION-SCREEN.
IF SY-DYNNR = 1000.
IF CH_EBELN = 'X' OR CH_VBELN = 'X'.
CALL SELECTION-SCREEN 100.
ELSE.
MESSAGE I000(Z50871MSG) WITH 'Please select atleast one checkbox'.
ENDIF.
ENDIF.
Regards
Sandeep Reddy -
How to disable a field in selection screen based on condition.
Hi,
I have 2 radio buttons- p_normd, p_recov and 2 other controls - like text boxes, say tb1 and tb2. and some mandatory fields below.
If i choose p_normd, i want one control(tb2) to be disabled and if i choose p_recov, i want the other control(tb1) to be disabled(tb2 should be enabled then.)
Currently i am using the following code. The 1'st radiobutton is intially checked. But the problem is when i click on the 2'nd radio button, the other control(tb1) is not getting disabled. When i double click, i get an error telling mandatory field to be filled. Only after the other mandatory fields below are filled, and after i double click on the unchecked radiobutton, the other control gets disabled.
Please suggest what to do..
The current code below:
AT SELECTION-SCREEN OUTPUT. "ON RADIOBUTTON GROUP rg01.
LOOP AT SCREEN.
IF p_normd EQ c_x AND screen-group1 = 'SC2'.
MOVE 0 TO screen-input.
MODIFY SCREEN.
ENDIF.
IF p_recov EQ c_x AND screen-group1 = 'SC1'. "IF screen-name = 'ERDAT-LOW' OR screen-name = 'ERDAT-HIGH'.
MOVE 0 TO screen-input.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Thanks,
AmmuHi
declare your parameter as below:
parameters: p_x type c radio button group g1 user-command r.
in at selection screen output event .
check for the radio button.
loop at screen.
if screen group is <desired value>
then screen-active = 0 or 1. <do whatever you want to do.>
modify screen.
endloop.
see below the sample code.
<<<<<AT SELECTION SCREEN EVENT>>>>>
AT SELECTION-SCREEN ON BLOCK B1.
IF P_LCOST = C_X.
PERFORM CLEAR_FIELDS. " Clearing fields before loading the screen
CALL SELECTION-SCREEN 100 STARTING AT 20 5.
ELSEIF P_MCOST = C_X.
PERFORM CLEAR_FIELDS1. " Clearing fields before loading the screen
CALL SELECTION-SCREEN 101 STARTING AT 20 5.
ENDIF.
IF SY-SUBRC = 0.
PERFORM VALIDATION. " Validating selection screen input
ELSE.
LEAVE TO TRANSACTION C_TRAN.
ENDIF.
<<<<<<DECLARATION PART>>>>>>
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_LCOST RADIOBUTTON GROUP GI DEFAULT 'X',
P_MCOST RADIOBUTTON GROUP GI.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF SCREEN 100 AS WINDOW TITLE TEXT-002.
SELECTION-SCREEN BEGIN OF BLOCK B2.
PARAMETERS: P_COAREA TYPE CSKS-KOKRS OBLIGATORY, " controlling area
P_FYR TYPE COEP-GJAHR OBLIGATORY, " fiscal year
P_PERIOD TYPE COEP-PERIO OBLIGATORY. " fiscal period
SELECT-OPTIONS: S_CCNTR FOR V_KOSTL OBLIGATORY, " Cost Center
S_COELM FOR V_KSTAR MODIF ID M1, " Cost element
S_PDATE FOR V_BUDAT OBLIGATORY. " posting date.
SELECTION-SCREEN END OF BLOCK B2.
SELECTION-SCREEN END OF SCREEN 100.
SELECTION-SCREEN BEGIN OF SCREEN 101 AS WINDOW TITLE TEXT-003.
SELECTION-SCREEN BEGIN OF BLOCK B3.
PARAMETERS: P_CCODE TYPE T001-BUKRS OBLIGATORY, " Company Code
P_FYEAR TYPE COEP-GJAHR OBLIGATORY. " fiscal year
SELECT-OPTIONS: S_GLACC FOR V_HKONT OBLIGATORY, " G/L Account
S_PCNTR FOR V_PRCTR MODIF ID M2, " Profit Center
S_PODATE FOR V_BUDAT OBLIGATORY. " posting date.
SELECTION-SCREEN END OF BLOCK B3.
SELECTION-SCREEN END OF SCREEN 101.
thanks
LG
Edited by: LalitG on Apr 13, 2011 1:38 PM -
Suppressing rows based on a condition
I have report, where I have to remove certain rows out of the report, based on the certain condition.
Note that, there are two characteristics in the rows, and one key figure in the columns. If the first characteristic value equals that of the second characteristic in the rows, I want to remove that row from display.
Row1 R1 R2 K1
Row2 R3 R3 K1
Row3 R2 R3 K1
Row4 R3 R2 K1
In the above example, I need to remove Row2, because both characteristics have same value, which is R3. I want to suppress those records, and just show Row1, Row3 and Row4.
Row1 R1 R2 K1
Row2 R3 R3 K1 -> remove this row
Row3 R2 R3 K1
Row4 R3 R2 K1
My problem is conditions only work on the key figures, not characteristics. I tried the replacement variables, but it is not working.
Any ideas?Hi,
You can achieve the solution if your 2 characteristic's data type is NUMC.
If it is NUMC, then try the below steps:
1. Create a formula in the Key Figures structure.
2. In the formula, create a formula variable, and on the formula variable select the processing type as Replacement Path. After that choose the first characteristic on the Characteristics selection.
3. Repeat step 2 again for second characteristic.
4. Now the two formula variables contains two characteristic. Select both of them and subtract it.
5. You will get the values 0 and not equel to 0.
6. Create a condition and suppress zero values of the formula key figure.
If it is not NUMC, then i guess you have to stage the data to another location. At the time of transformation you have to supress the records.
Vivek -
Radio group in classic report based on another column on the same row.
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
Application Express 4.1.0.00.32
How can I have a radio group column based on an LOV utilizing another column on the same row of the report?
For example: what if I had a survey application and depending on the likert scale that was assigned to the question there would be different possible answer choices:
Question 1 on row 1 of the report: The class instructor was friendly?
Likert scale choice is Agreement.
Choices on Radio Group: Strongly Agree, Agree, Undecided, Strongly Disagree
Question 2 on row 2 of the report: The class offered good materials?
Likert scale choice is Quality.
Choices on Radio Group: Excellent, Below Average, Average, Above Average, Excellent
The radio group can change per row depending on the Likert scale assigned to the question which is assigned to a different column on the row.
Can LOV utilize the column? :
SELECT scale_text
FROM scale_choices
WHERE scale_category_choice_id = 2 <<= this would be the Likert scale identifier
ORDER
BY display_orderHere is the answer:
APEX_ITEM.SELECT_LIST_FROM_QUERY(
p_idx IN NUMBER,
p_value IN VARCHAR2 DEFAULT NULL,
p_query IN VARCHAR2,
p_attributes IN VARCHAR2 DEFAULT NULL,
p_show_null IN VARCHAR2 DEFAULT 'YES',
p_null_value IN VARCHAR2 DEFAULT '%NULL%',
p_null_text IN VARCHAR2 DEFAULT '%',
p_item_id IN VARCHAR2 DEFAULT NULL,
p_item_label IN VARCHAR2 DEFAULT NULL,
p_show_extra IN VARCHAR2 DEFAULT 'YES')
RETURN VARCHAR2; -
I have a pop-up menu in the first cell of every row with three choices (and I may add more at a later date). I want the fill color of the row to change depending on which thing is selected. Is this hard to do?
Hi,
In essence the same as Wayne's answer, but with a slight modification to fit to duplicate your 'color the whole row' specification. The final result, with Table 2 slid behind Table 1, is shown.
Table 2 is a single column table with the same number of rows as Table 1. The table is resized to match the full width of Table 1.
In A2, use the formula =Table 1::A2 to copy the value from that cell in Table 2. Fill the formula down through the rest of the column.
Select all the cells in Table 2 (except the header row), and apply conditional formatting rules such as those below.
Note that the Conditional Format rules are set to apply the same colour to text and fill in the cell, so that the text disappears.
When Table 2 is ready, select it, then go Arrange > Send to Back.
Before sliding Table 2 behind Table 1, Select Table 1 and use the Table Inspector to set the Cell Background to None (see red arrow in illustration). If This table has a Header column, you need to select the header cells independently and again set the Cell Background to None.
Now select Table 2 and drag it to a position partially under Table 1. When you see the blue alignment guides on both sides, or at the top and bottom, of Table 1, release the mouse button and use the arrow keys to nudge Table 2 into its final position.
Regards,
Barry -
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, -
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.
Maybe you are looking for
-
I'm a very happy iPad user considering getting my first Mac -- and have pretty much settled on the 2.66Ghz Core i7 MacBook Pro. My biggest question concerns the RAM installed in the machine. I'd like to max it out to 8 gigs, and want to know how much
-
My new Trackpad works perfectly with my laptop however it will not work with my Mac Pro (2.66 GHz Quad Core) even I have discoverable on. Any suggestions and advice please?
-
My number keys stopped working, help
I tried toggling number lock and that did nothing, any ideas please
-
How can i download LIveCycle ES4manually given the Serial number?
The link to download livecycle ES4 is showing "not applicable" under my subscriptions, and when i try to download the "English" version as directed i get an error message.
-
How can I sync iPhone calendar with my wife's iPhone?
How can I sync my iPhone calendar with my wife's iPhone calendar and vice versa? Along with my iPad and iMac?