Column hiding /unhiding based on a condition
I have a report in which I want to add "State" Column. But it show up only when "Region" = 'Northeast'. And do not show State for other "Region"
So basically, I want to hide "State" column dynamically based on condition where "Region"='Northeast'.
Would Siebel On Demand let us do Column hiding /unhiding based on a data condition?
Please let me know if this is possible.
Thanks
Rakesh
I don't think SOD lets hide/unhide a column based on a condition. All you can do is restrict the number of rows using a filter.
Similar Messages
-
Column value coloring Based on the condition in ssrs 2008
Hi,
I need to change color formating based on below conditions
Red if <=28 days or > 65 days
Green if >28 and <=60 days
Yellow if > 60 days and <=65 days
<=0 No color
I tried with below IIF condition it's not working.
=iif(Fields!HDSI13.Value<=0,
"No color",iif((Fields!HDSI13.Value<=28
or Fields!HDSI13.Value>64),"Red",iif((Fields!HDSI13.Value>29
and Fields!HDSI13.Value<=60),"Green",iif((Fields!HDSI13.Value>60
and Fields!HDSI13.Value<=65),"yellow",Nothing))))
Can any one help me on this.
Thanks,
Manasa.
Thank You, Manasa.Vhi all,
When i wrote like this in table report ...woking fine.
=iif(((Fields!HDSI13.Value<=28
and Fields!HDSI13.Value>0)
or Fields!HDSI13.Value>64),"Red",iif((Fields!HDSI13.Value>=29
and Fields!HDSI13.Value<=60),"Green",iif((Fields!HDSI13.Value>=61
and Fields!HDSI13.Value<=65),"yellow",iif(Fields!HDSI13.Value<=0,"Nocolor",""))))
Thank You, Manasa.V -
Column data restriction based on join condition
All,
SELECT e.ename,
d.dname,
e.job,
e.comm, e.sal
FROM emp e,
dept d
WHERE e.deptno=d.deptno
AND e.empno =7788
AND e.comm IS NOT NULL;
In this query, if the comm for the empno=7788 is not null, then i am able to retrive the record, If comm is not null, display the entire record along with comm details, if it is null, display the entire record without comm value(may be as null).
If commission is not null, then display the entire record, if it is null, then for e.comm, e.sal I want to display null values.
PS: I am in a situtation like this kind of. Kindly give me some idea.
ThanksThank you Frank and Sorry for not so clear in explanation.
SQL> desc demois_wo_routing
Name Null? Type
ORG_ID NUMBER
ASSIGNED_TO VARCHAR2(10)
COMMENTS VARCHAR2(55)
DUE_DATE DATE
ENTER_DATE NOT NULL DATE -- is the APPROVED_DATE
ENTER_USER VARCHAR2(30) -- is the APPROVER_NAME
PRIORITY NUMBER
START_DATE DATE
STATUS NOT NULL VARCHAR2(10)
WO_NUMBER NOT NULL VARCHAR2(10)
SQL> desc demois_sr_routing
Name Null? Type
ORG_ID NUMBER
ASSIGNED_TO VARCHAR2(10)
COMMENTS VARCHAR2(55)
DUE_DATE DATE
ENTER_DATE NOT NULL DATE
ENTER_USER VARCHAR2(30)
PRIORITY NUMBER
REQ_NUMBER NOT NULL VARCHAR2(10)
START_DATE DATE
STATUS NOT NULL VARCHAR2(10)
SQL> select enter_user,wo_number,enter_Date,status from demois_wo_routing where wo_number='WO000853';
ENTER_USER WO_NUMBER ENTER_DAT STATUS
E60075334 WO000853 14-MAY-13 APPROVED
C10000001 WO000853 09-APR-13 OPEN
C10000001 WO000853 09-APR-13 ASSIGNED
E60075373 WO000853 09-APR-13 PND APPRVL
SQL> select enter_user,req_number,enter_date,status from demois_sr_routing where req_number=(select req_number from demois_req where wo_number='WO000853');
ENTER_USER REQ_NUMBER ENTER_DAT STATUS
E60075373 SR000818 09-APR-13 SCHEDULED
E60075334 SR000818 14-MAY-13 SCHEDULED
C10000001 SR000818 09-APR-13 SCHEDULED
C10000001 SR000818 09-APR-13 SCHEDULED
SQL> SELECT fm.first_name || ' ' || fm.last_name AS approver_name,
2 fpc.communication_value AS approver_cell
3 FROM demo_person fm, demo_person_communication fpc
4 WHERE fm.person_code = 'E60075334' --ENTER_USER from FSR/ FWR table
5 AND fm.person_id = fpc.person_id
6 AND fpc.communication_type = 'Telephone';
APPROVER_NAME
APPROVER_CELL
Nicy Varghese
44952937
SQL> SELECT fm.first_name || ' ' || fm.last_name AS approver_name,
2 fpc.communication_value AS approver_cell
3 FROM demo_person fm, demo_person_communication fpc
4 WHERE fm.person_code =
5 (SELECT enter_user
6 FROM demois_wo_routing
7 WHERE wo_number = 'WO000853' AND status = 'APPROVED')
8 AND fm.person_id = fpc.person_id
9 AND fpc.communication_type = 'Telephone';
APPROVER_NAME
APPROVER_CELL
Nicy Varghese
44952937
ACTUAL QUERY :---- If i run the below query i will definitely get a record of WO_NUMBER along with the other details.
SELECT w.wo_number,
DECODE (NVL (p.print_wo_barcode_flag, 'N'),
'Y', '*' || w.wo_number || '*',
NULL
) barcode_wo_number,
INITCAP (w.maint_type) maint_type, INITCAP (w.wo_status) wo_state,
w.priority, w.modify_date, w.start_date, w.due_date,
INITCAP (w.description) description, w.method, w.crew,
INITCAP (w.craft) craft, w.assigned_to, w.est_hours,
DECODE (w.req_type,
'S', 'Service',
'P', 'PM',
'W', 'Project',
'T', 'Standing WO'
) req_type,
w.req_number, INITCAP (w.requestor) requestor, w.telephone,
w.mail_code, w.department, w.cp_number, w.site, w.building,
NVL (w.phase, 0) phase, w.FLOOR, w.room, w.equipment,
INITCAP (w.close_comments) close_comments, w.alt_requestor,
w.alt_telephone, w.alt_department, w.alt_mail_code, w.schedule_user,
DECODE (w.equipment,
NULL, NULL,
'*' || w.equipment || '*'
) equip_barcode,
INITCAP (e.NAME) employee_name, w.schedule_date, w.pl_number,
INITCAP (q.nomenclature) nomenclature, INITCAP (q.mfr) mfr,
INITCAP (w.nonavailable_time) nonavailable_time, w.enter_user,
a.asset_class_code, INITCAP (a.description) asset_class_description
FROM demois_emp e,
demois_equip q,
demois_req w,
demois_fmm_config p,
demois_asset_class a
WHERE w.wo_number IS NOT NULL
AND NVL (w.asset_type, 'N') = 'N'
AND w.equipment = q.equipment(+)
AND w.assigned_to = e.employee(+)
AND (w.assigned_to = :p_assigned_to OR :p_assigned_to IS NULL)
AND ( (:p_marked_to_print = 'Y' AND w.print_ticket = 'Y')
OR (:p_wo_number IS NOT NULL)
AND (w.site = :p_site OR :p_site IS NULL)
AND (w.crew = :p_crew OR :p_crew IS NULL)
AND (w.craft = :p_craft OR :p_craft IS NULL)
AND (w.maint_type = :p_maint_type OR :p_maint_type IS NULL)
AND (w.req_type LIKE NVL (:p_req_type, '%'))
AND (w.wo_number LIKE NVL (:p_wo_number, '%'))
AND q.asset_class_id = a.asset_class_id(+)
ORDER BY wo_number;
The above is the sample data for my logic. The last one is the original query which am modifying with the tables listed above. The last query will return a record based on WO_NUMBER. Now i have to passing the WO_NUMBER to FWR table checking whether it is in APPROVED status or not. If not need to in FSR table with the associated SR ( req_number) for that WO_NUMBER.
If there is a record in 'APPROVED' state, need to display the approver name from FP and FPC tables by passing value of the ENTER_USER from FSR / FWR. Till now it is fine , if the STATUS is 'APPROVED'.
The problem here is, there may a situation where the WO_NUMBER ( or respective SR number) will not be in 'APPROVED' status in both the tables. In this case also i need to get the record as usual like if i run the last query (ACTUAL QUERY).
There is no direct relation between the FSR and FWR tables here. Only DEMOIS_REQ table has REQ_NUMBER (SR000818) and WO_NUMBER ( WO000853 ).
Again sorry, If i am not clear enough.
Thanks in advance. -
Inserting new columns based on the condition!
Hi guys,
I have a very simple query like the following…
SELECT table2.column_code2,
table2.column_description2,
table2.column_code1,
table1.column_description1
FROM database_001.table2 table1 LFET OUTER JOIN database_001.table2 table1 on (table2.column_code1 = table1.column_code1)
From this query, its returning me a result set of something like below:
column_code1 column_description1 column_code2 column_description2
RO1 BOOK RL1
PDF/ECOPY
RO2 PAPER RL2
CONFERENCE
RO5 JOURNAL
RL11 OTHER
Now, on the above query I want to insert three extra columns with the name (status, location and contact) where the results in the extra three columns would be based on the conditions I want to define in the query based on the above results…
Something for example (sorry, I am not trying to write a condition: my question is how to write it),
if column_code1 = RO1 and column_description2 = PDF/ECOPY on status column it should return a value ‘ONLINE’ & on location column it should return ‘WEB’ and on contact column it should write ‘BOB’.
Also,
if column_code1 = RO5 and column_description1 = JOURNAL on status column it should return a value ‘ON PRESS FOR PRINT’ & on location column it should return ‘S.R STREET, LONDON’ and on contact column it should write
‘SMITH’ like below result…so the final output should be the top four columns and the extra three columns…I hope someone can help me into this…thanks a lot…
status location
contact
ONLINE WEB
BOB
ON PRESS FOR PRINT S.R STREET, LONDON SMITHHi artistdigital,
you can use case statment for same in sql server. MSDN link - > http://technet.microsoft.com/en-us/library/ms181765.aspx
Try code like this:
SELECT table2.column_code2,
table2.column_description2,
table2.column_code1,
table1.column_description1,
case when column_code1 = 'RO1' and column_description2 = 'PDF/ECOPY' then 'ONLINE'
when column_code1 = 'RO5' and column_description1 = 'PDF/ECOPY' then 'ON PRESS FOR PRINT'
end as [status],
case when column_code1 = 'RO1' and column_description2 = 'PDF/ECOPY' then 'WEB'
when column_code1 = 'RO5' and column_description1 = 'PDF/ECOPY' then 'S.R STREET, LONDON'
end as [Location],
case when column_code1 = 'RO1' and column_description2 = 'PDF/ECOPY' then 'BOB'
when column_code1 = 'RO5' and column_description1 = 'PDF/ECOPY' then 'SMITH'
end as [contact]
FROM table2
join table1
on table2.column_code1 = table1.column_code1
Regards Harsh -
Hi All,
I have a problem with Column Hiding. Based on a parameter I want to hide a column in my table. I am writing the code as follows:
<?if@column:./quote_line/lp_flag='Y'?>unit_list_price<?end if?> -header level
<?if@column:./quote_line/lp_flag='Y'?><?List_price?><?end if?> - data level.
The header level info is hiding but at the data level it is showing Null value for that column.
Even I tried with
<?if@cell:./quote_line/lp_flag='Y'?><?List_price?><?end if?> -data level
this is also not working.
Any ideas?You may need to be more specific about the column on the data level. I assume at the data level you are looping over data ?
If so, then you probably need to come up out of the loop to check the lp_flag ie
<?if@column:../quote_line/lp_flag='Y'?><?List_price?><?end if?>
Notice the second period to get you up a level ie ../ like navigating a directory tree. You will need as many ../ as required to get you up to the header level in the tree.
regards
tim -
How to create a column based on a condition ?
Hi all,
I am trying to create a stored procedure that will return ID,Name and a column of type bit called called checked based on a condition
please review my code and tell me what is wrong with it
ALTER PROCEDURE [dbo].[SelectStoresNames]
AS
BEGIN
WITH locations_CTE ( ID, Name, Checked)
AS
select loc.ID,loc.Name,
(case when loc. ID in (select distinct a.StoreId
from mPromoteStores a
inner join mPromote b
on a.PromoteId=b.PromoteId
where b.promoId=144120) then 1 else 0 end as [Checked])
FROM [dbo].[mLocations] loc where SchedulePullEnabled=1 order by Name
Select *
from locations_CTE
ENDPlease post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. You have no idea!
Temporal data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect.
This is minimal polite behavior on SQL forums.
>> I am trying to create a stored procedure that will return store_id, store_name and a column of type bit called “checked” based on a condition <<
I fixed the vague, useless, generic data elements, made wild guesses on the DDL you did not post and got rid of the assembly language bit flags (https://www.simple-talk.com/sql/t-sql-programming/bit-of-a-problem/)
1. IN (SELECT DISTINCT ..) is redundant
2. aliases in alphabetic order are no help for maintaining code
3. What is that “m” prefix? Better not be metadata...
4. We also do not use “-cte” postfixes; tell us what the table is and not how you got it. This is another version of the “vw-” or “Volkswagen” design flaw for views.
5. “promote” is a verb, so how can it have an identifier? Entities have identifiers. A set of “Promotions” could have a “promo_id”, but this might be a typo ..
6. Is “schedule_pull_enabled” another assembly language flag? I have the horrible feeling your unseen schema is not in 1NF ...
Since you did not post DDL here is as far as I can get ..
CREATE PROCEDURE Select_Stores_Names
AS
SELECT PS.store_id, PS.store_name
FROM Promote_Stores AS PS,
Promotes AS P
WHERE PS.promote_id = P.promote_id
AND P.promo_id = 144120 -- promo vs promote?
AND ???;
Want to follow the forum rules and try again?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Need to show the images in calculated column based on the condition in sharepoint 2013.
Hi ,
I'm working in sharepoint 2013, In this i want to show an image in calculated column based on the condition, but image is not showing .
In sharepoint 2010 its working with help of javascript in content editor on the same page. Same thing i tried in SP 2013. but doesn't work.
Could any one please give proper solution for this?
Thanks in advance.
by,
Siva.Hi please provide the JS you have used in the content editor as well as the calculation for the column so we can better understand what's maybe differs?
Blog: chrisstahl.wordpress.com Twitter:
@Cstahl -
Oracle Business Intelligence How to choose data set based on a condition
Hi,
I am using Oracle Business Intelligence for creating reports, i am facing a situation where i have two quries (data sets in BI), one to display a Failure message and other to fetch data from the table to be displayed in the report.
The problem is i am unable to choose which data set to run based on a condition. How to use a condition based on which the dataset will be run
For example : i will read a table column value if it is 'S' means success, then i have to run the dataset to fetch the data from the table.
If the column value has 'F' then i have to run the dataset which will display failure message
Please let me know if any of you have any idea on this
Thanks in advance
MuthukumaranHi Chinna,
You have to use some scripting as well as coding to perform the tasks listed by you. First of all make your form Dynamic, In your Adobe lifecycle Designer, open your form,
Goto, File --> Form Properties,
Goto the Defaults tab,
Select "Dynamic PDF" for the XDP Preview Format:
Click OK.
This setting will now allow dynamicity in your Form, when you view it in PDF Preview tab.
For Hiding/Unhiding the fields/SF, you can use the presence property and set it based on the conditions. like:
if (this.rawValue == null)
TextField1.presence = "hidden";
For your second task, you may map a method corresponding to onSubmit event of the IF and write the code to create the workflow and make RFC call here.
For third one, you need to convert the PDFObject from Binary context into a byte array and save it at appropriate location.
Hope I have answered all your queries.
Cheers,
Arafat -
Dropdown editable in a table based on a condition
Hi,
I would like to know how to solve these problems.
1. I have a cell (of the type dropdown by key) in a table, which is editable or not, depending on a condition ? Is this is possible? Please let me know if there is a sample code
2. So basically I have a table that has 2 entries in it, user details and one of the fields in FLAG showing the values Yand N for the user. I want the table in the webdynpro application to show the 2 user entries and then in the Flag column have a DROPDOWNBYKEY that DEFAULTS to showing what flag the user has, but also allows the user to CHANGE the entry.
Thanks in advance
I appreciate for the help.is possible
In your Context node which is binded to the table as DataSource, add an attribute WDY_BOOLEAN type
In layout bind the newly created attribute to the dropdown UI element Enable property
while filling your context node, fill the attribute with abap_true and abap_false based on your condition
Abhi -
Doubt in the value return by the function based on given condition
Hi,
Below function should return the value based on the value of in_row_number_high variable.
I have used CASE but it does't return proper value.
How could I give that condition?
Please help.
FUNCTION gen_total_lane_count_pct
in_lane_id edr_rpt_by_ranges_output.lane_id%TYPE,
in_direction_id edr_rpt_by_ranges_output.direction_id%TYPE,
in_interval_start_date_time edr_rpt_by_ranges_output.interval_start_date_time%TYPE,
in_interval_end_date_time edr_rpt_by_ranges_output.interval_end_date_time%TYPE,
in_row_number edr_rpt_by_ranges_output.range_low%TYPE,
in_row_number_high edr_rpt_by_ranges_output.range_high%TYPE,
in_lane_min edr_lane_by_class_report_data.v_lane%TYPE,
in_lane_max edr_lane_by_class_report_data.v_lane%TYPE
RETURN NUMBER
IS
my_total NUMBER(18);
my_count_pct NUMBER(18);
my_total_pct NUMBER(18);
my_each_count_result NUMBER(18);
my_count_result NUMBER(18);
my_total_count NUMBER(18);
lane_start edr_rpt_tmp_report_lanes.site_lane_id%TYPE;
lane_end edr_rpt_tmp_report_lanes.site_lane_id%TYPE;
row_start NUMBER(12);
row_end NUMBER(12);
BEGIN
my_count_pct := 0 ;
SELECT MIN(site_lane_id)
INTO lane_start
FROM edr_rpt_tmp_report_lanes
WHERE edr_rpt_tmp_report_lanes.output_lane_id = in_lane_id
AND edr_rpt_tmp_report_lanes.output_direction_id = in_direction_id;
SELECT MAX(site_lane_id)
INTO lane_end
FROM edr_rpt_tmp_report_lanes
WHERE edr_rpt_tmp_report_lanes.output_lane_id = in_lane_id
AND edr_rpt_tmp_report_lanes.output_direction_id = in_direction_id;
SELECT MIN(range_low)
INTO row_start
FROM edr_rpt_by_ranges_output;
SELECT MAX(range_low)
INTO row_end
FROM edr_rpt_by_ranges_output;
my_each_count_result := edr_rpt_lane_by_class_package.gen_total_lane_count (
in_lane_id,
in_direction_id,
in_interval_start_date_time,
in_interval_end_date_time,
in_row_number,
in_row_number_high,
in_lane_min,
in_lane_max
my_count_result := edr_rpt_lane_by_class_package.gen_total_lane_count (
in_lane_id,
in_direction_id,
in_interval_start_date_time,
in_interval_end_date_time,
row_start,
row_end,
in_lane_min,
in_lane_max
my_total_count := edr_rpt_lane_by_class_package.gen_total_lane_count (
in_lane_id,
in_direction_id,
in_interval_start_date_time,
in_interval_end_date_time,
in_row_number,
in_row_number_high,
lane_start,
lane_end
IF (my_each_count_result > 0) THEN
my_total := edr_rpt_lane_by_class_package.gen_total_lane_count (
in_lane_id,
in_direction_id,
in_interval_start_date_time,
in_interval_end_date_time,
row_start,
row_end,
lane_start,
lane_end
CASE
WHEN in_row_number_high = row_end THEN
my_count_pct := ROUND((my_each_count_result / my_count_result ) * 100 );
WHEN in_row_number_high < row_end THEN
my_count_pct := ROUND((my_each_count_result / my_total ) * 100 ) ;
ELSE
RAISE_APPLICATION_ERROR(-20101, 'The row number specified is not recognized.');
END CASE;
END IF;
return my_count_pct;
END gen_total_lane_count_pct; Edited by: Indhu Ram on Jan 5, 2010 11:43 AMHi,
I have to find out the % value for each column value( For rx if there is only 2 columns).To calculate the % , each column value should get divided by the total of that column value.
To calculate the % for the total row , each column total should get divide by the sum of column ( sum of column 1 + sum of column 2)values.
ROUND((my_each_count_result / my_count_result ) * 100 ) ---- This calculaton gives me the % for the total row.
ROUND((my_each_count_result / my_total ) * 100 ) ------- This calculation gives the % for the data row.
The condition that I have tried is, if it reaches end of data row (to achieve that condition I have given this condition in_row_number_high < row_end )
Now my result returns only values based on this condition -- in_row_number_high < row_end .
It does't look for the first condition.
CASE
WHEN in_row_number_high = row_end THEN
my_count_pct := ROUND((my_each_count_result / my_count_result ) * 100 );
WHEN in_row_number_high < row_end THEN
my_count_pct := ROUND((my_each_count_result / my_total ) * 100 ) ;
ELSE
RAISE_APPLICATION_ERROR(-20101, 'The row number specified is not recognized.');
END CASE;
Hope , you have some good understanding now. Please help me how could I do this? -
Remove duplicates based on a condition
Hi all,
I need help on a query to remove duplicates based on a condition.
E.g. My table is
FE CC DATE FLAG
FE1 CC1 10/10 FB
FE1 CC1 9/10 FB
FE1 CC1 11/10 AB
FE1 CC2 9/10 AB
FE1 CC2 10/10 FB
FE1 CC2 11/10 AB
I want to remove all duplicate rows on FE and CC based on the below condition :
DATE <MAX(DATE) WHERE FLAG='FB'
That means I want to remove the row FE1 CC1 9/10 FB
but not the rows
FE1 CC1 10/10 FB
and
FE1 CC1 11/10 AB
as only the row FE1 CC1 9/10 FB has date <MAX(DATE) WHERE FLAG='FB'.
Similarly I want to keep
FE1 CC2 10/10 FB
FE1 CC2 11/10 AB
but not
FE1 CC2 9/10 AB
Many thanks.Hi,
Do you want to DELETE rows from the table, or just not show some rows in the output? Since you're talking about a "query", rather that a "DELETE statement", I'll assume you want to leave those rows in the table, but not show them in the output.
Here's one way:
WITH got_r_num AS
SELECT fe, cc, dt, flag
, RANK () OVER ( PARTITION BY fe_cc, flag
ORDER BY dt DESC
) AS r_num
FROM table_x
SELECT fe
, cc
, TO_CHAR (dt, 'fmMM/YY') AS dt
, flag
FROM got_r_num
WHERE flag != 'FB'
OR r_num = 1
;if you'd care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.
This assumes that the column you called DATE (which is not a good column name, so I called it dt) is a DATE, and that you are displaying it in MM/YY format.
This also assumes that dt and flag are never NULL.
If I guessed wrong about these things, then the query can be changed; it will just be a little messier. -
Grey out a particular row in ALV based on some condition.
Hi All,
How can we grey out the particular row in ALV based on some condition( I am using the function modules and not OOPS).
Regards
Ramesh.Hello Ramesh
In this case you need to add a specific field to your structure:
TYPES: BEGIN OF ty_s_outtab.
INLCUDE TYPE <my table or structure>.
TYPES: CELLTAB TYPE lvc_t_styl. " name is arbitrary but this one is most frequently used
TYPES: END OF ty_s_outtab.
DATA: gt_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
You can use the fieldcatalog to make an entire column non-editable (LVC_S_FCAT-EDIT = ' ' ).
However, in case of rows you need to inactivate all cells of this row. For sample coding please refer to thread:
How to conditionally set ALV field as hotspot
Regards
Uwe -
Advance Aggregation based on multiple conditions
Hi members,
I have a situation where I need to aggregate data based on multiple conditions. Relevant details of the problem is as follows.
There is a table (let's call X). It has following columns:
Transaction_Time (date)
Transaction_direction (Possible values IN or OUT)
Column_1
Column_2
Based on the columns: Transaction_direction, Column_1, Column_2, the type of the transaction will be derived. For example, if transaction_direction='IN' then transaction type is IN, if 'OUT' then transaction types are Out. Similarly if Column_1=Column_2 then transaction type is Txn_3 otherwise 4.
Based on date and transaction types the aggregation will happen.The sample output would be:
Time, Transaction type (IN, OUT, Txn_3, Txn_4), Sum of transactions
10-June-2013 00:00 IN Transactions 2500
10-June-2013 00:00 Txn_3 Transactions 3590
and so.
IN and Out transactions are easy to be derived using decode() function. However avoiding multiple UNION ALL and write a single SQL for all four conditions is tricky one.
Hope I clarified.
NeerajWhat version of Oracle are you using?
If you're on 11.x you can use the UNPIVOT feature as follows:
with t (Transaction_Time, Transaction_direction, Column_1, Column_2) as (
select date '2013-06-10', 'IN', 1, 1 from dual union all
select date '2013-06-10', 'IN', 2, 2 from dual union all
select date '2013-06-10', 'IN', 1, 2 from dual union all
select date '2013-06-10', 'IN', 3, 4 from dual union all
select date '2013-06-10', 'OUT', 3, 3 from dual union all
select date '2013-06-10', 'OUT', 3, 4 from dual
select * from (
select
transaction_time
, sum(case when transaction_direction = 'IN' then 1 end) as IN_count
, sum(case when transaction_direction = 'OUT' then 1 end) as OUT_count
, sum(case when Column_1 = Column_2 then 1 end) as Txn_3_count
, sum(case when Column_1 != Column_2 then 1 end) as Txn_4_count
from t
group by transaction_time
unpivot (
txn_count for transaction_type in (
IN_count as 'IN'
, OUT_count as 'OUT'
, Txn_3_count as 'Txn_3'
, Txn_4_count as 'Txn_4'
order by transaction_time, transaction_type
TRANSACTION_TIME TRANSACTION_TYPE TXN_COUNT
2013-06-10 IN 4
2013-06-10 OUT 2
2013-06-10 Txn_3 3
2013-06-10 Txn_4 3
If you're okay with getting one row per date with the 4 counts you can just use the inner select above, i.e.
select
transaction_time
, sum(case when transaction_direction = 'IN' then 1 end) as IN_count
, sum(case when transaction_direction = 'OUT' then 1 end) as OUT_count
, sum(case when Column_1 = Column_2 then 1 end) as Txn_3_count
, sum(case when Column_1 != Column_2 then 1 end) as Txn_4_count
from t
group by transaction_time
order by transaction_time
TRANSACTION_TIME IN_COUNT OUT_COUNT TXN_3_COUNT TXN_4_COUNT
2013-06-10 4 2 3 3
If you want to sum transaction amounts then use the same logic, except in the case statements replace 1 with the column you want to sum.
Regards,
Bob -
Trying to alter font on a report row based on data condition
Hello.
I have an Apex application with a "classic" SQL report and a corresponding form.
In the report region I am pulling all items from a table (Select * from TASKS)
The TASKS table contains many columns including DUE_DATE and COMPLETE_DATE field.
I am trying to find a way to format the rows in my report based on the condition of those two fields.
If the record has a complete_date (not null) then I want to change the font for the entire row (each column) to be grey.
If the record does not have a complete_date (null) and due_date is before today, I want the row to be bold and red.
Otherwise, the row would display standard black text.
I can't seem to find a straightforward way to do this in Apex.Hi JodyMorin,
Try looking at this post:
Conditional item formatting (color)
You will need to tweak the code a bit for your needs, but I hope it helps.
-Marc -
Summary based on above condition
I have master and detailed blocks
In master block base table items -
1)total_import - stored summary of weight from details blocks based
2)total_export - stored summary of weight from details blocks based
In details block i have two base table colummn
1)transaction_type
2)weight
when user input the weights it will check the transaction_type
transaction_type=1 (ie import ) it should added with total_import
transaction_type=2 (ie export ) it should added with total_export
I want to make summary based on above condition
Help me this issue
thanks
rdkHello rdk
Pls in ur details block ....
1.*Create 2 non-db summary* column for both :total_import & :total_export
2.*Then Create When-Validate-Item Trigger* for the weights then write the following code...
IF :transaction_type=1 THEN
:total_import := NVL(:weights ,0) ; -- will assign all the import transactions or inputs...
ELIF transaction_type=2 THEN
:total_export := NVL( :weights ,0); -- will assign all the export transactions or inputs...
END IF;3.Then in PRE-INSERT & PRE-UPDATE Trigger assign the 2 non db items to it's equilavent db ones in the Master-Block
Hope it works just fine :)
Regards,
Abdetu...
Edited by: Abdetu on Feb 27, 2011 6:24 AM
Maybe you are looking for
-
Patch 20133080:R12.PO.D compatible with 12.1.3
Hi, we are encountering the Bug 20133080, that cancels the PR line if the PO line is cancelled. Our EBS is 12.1.3, but this patch 20133080:R12.PO.D stated that it was for 12.2.3. however upon checking the patch details README File (https://updates.or
-
How to handle format trigger in bi publisher report
Hi all, anyone have idea how to handle format trigger in bi publisher report.... also if someone will illustrate the how exactly we use the triggers in bi publisher reports. regards Ratnesh
-
I updated to the newest version of Maverick, and nor my MacBook Pro (late 2009) does not follow the energy saving instructions in Systemsettings.They have worked perfectly up until then, and I have made no other changes than updating the OS. What to
-
How to get audio input with no line in jack?
Apologies for this very basic question but I am increasingly lost and confused the more I search. I want to convert some audio cassette tapes into mp3. I have an older mac mini that I believe does not have any kind of audio input jack. I have heard f
-
Selection screen fields in query
experts i have created a query with 5 selection screen fields, now i want to change the order of the fields in the selection screen. Earlier: Material order delivery qty amount Now i want order material delivery amount qty In sq01 i tried but there a