Conky config question - running in multiple columns?
Is it possible to display conky's output in rows rather than in columns? Example: I want to more or less cut my config in 1/2 and have the temps+ everything under them appear to the right of the CPU usage bit.
# Swap Usage:$color $swapperc%${color lightgrey}
# the ${template x x x} command uses /sys/bus/platform/devices
# for this to work you need both lm-sensors and hddtemp
# get both from main repos
# set to yes if you want Conky to be forked in the background
background no
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
out_to_console no
# X font when Xft is disabled, you can pick one with program xfontsel
#font 7x12
#font 6x10
#font 7x13
#font 8x13
#font 7x12
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
#font -artwiz-snap-normal-r-normal-*-*-100-*-*-p-*-iso8859-1
# Use Xft?
use_xft yes
# Xft font when Xft is enabled
xftfont Bitstream Vera Sans Mono:size=8
#own_window_transparent no
#own_window_colour hotpink
# Text alpha when using Xft
xftalpha 0.8
#on_bottom yes
# Update interval in seconds
update_interval 2
# Create own window instead of using desktop (required in nautilus)
#own_window no
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Minimum size of text area
#minimum_size 250 5
maximum_width 258
# Draw shades?
draw_shades no
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
# Stippled borders?
stippled_borders 10
# border margins
border_margin 4
# border width
border_width 1
# Default colors and also border colors
default_color white
default_shade_color white
default_outline_color white
# Text alignment, other possible values are commented
#alignment top_left
#minimum_size 10 10
#alignment top_right
alignment bottom_left
#alignment bottom_right
# Gap between borders of screen and text
gap_x 12
gap_y 37
# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer no
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
TEXT
${color #ddaa00}$nodename$color
$sysname $kernel on $machine
${color lightgrey}Uptime:$color $uptime ${color lightgrey}- Load:$color $loadavg${color lightgrey}
RAM Usage:$color $memperc% or $mem of $memmax${color lightgrey}
$color$stippled_hr${color lightgrey}
Intel Xeon X3360 @ $color${freq_g} GHz${color lightgrey} (Vcc: ${execi 8 sensors | grep Vcc | cut -c15-19} V)
${color black}${cpugraph 000000 5000a0}${color lightgrey}
${color lightgrey}Core0:$color ${platform coretemp.0 temp 1} °C${color grey} @$color ${cpu cpu1}% ${alignr}${cpubar cpu1 6,120}
${color lightgrey}Core1:$color ${platform coretemp.1 temp 1} °C${color grey} @$color ${cpu cpu2}% ${alignr}${cpubar cpu2 6,120}
${color lightgrey}Core2:$color ${platform coretemp.2 temp 1} °C${color grey} @$color ${cpu cpu3}% ${alignr}${cpubar cpu3 6,120}
${color lightgrey}Core3:$color ${platform coretemp.3 temp 1} °C${color grey} @$color ${cpu cpu4}% ${alignr}${cpubar cpu4 6,120}${color grey}
${color grey} CPU:$color ${platform it87.656 temp 2} °C ${color grey} Fan1:$color ${platform it87.656 fan 1}${color grey} RPM @ $color${execi 8 cat /sys/class/hwmon/hwmon4/device/pwm1}
$color$stippled_hr${color lightgrey}
${color grey} GPU:$color ${execi 8 nvidia-settings -q gpucoretemp | grep nov | cut -c42-43} °C ${color grey} M/B:$color ${platform it87.656 temp 1} °C
${color grey} sda:$color ${execi 300 sudo hddtemp /dev/sda | cut -c25-26} °C ${color grey} sdb:$color ${execi 300 sudo hddtemp /dev/sdb | cut -c34-35} °C ${color grey} sdc:$color ${execi 300 sudo hddtemp /dev/sdc | cut -c33-34} °C
$color$stippled_hr${color lightgrey}
${color slate grey} /dev/shm: ${color }${fs_used_perc /dev/shm} % ${fs_bar /dev/shm}
${color grey}$stippled_hr${color light grey}
${color lightgrey}Processes:$color $processes ${color grey}Running:$color $running_processes
${color}Name PID CPU% MEM%
${color #ddaa00} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color}Mem usage
${color #ddaa00} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${color lightgrey} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${color lightgrey} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
There are 4 files, so I am running 4 instances of conky. I will post the files from left to right.
background no
update_interval 1.0
double_buffer yes
use_xft no
xftfont Monospace:size=10
xftalpha 0.8
own_window yes
own_window_transparent yes
own_window_type override
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#on_bottom yes
minimum_size 320 42
draw_shades no
draw_outline yes
draw_borders yes
draw_graph_borders no
stippled_borders 0
border_margin 0
border_width 0
default_color white
default_shade_color black
default_outline_color black
alignment top_left
gap_x 10
gap_y 875
#gap_y 10
no_buffers yes
TEXT
Toshibuntu
${hr}
${color #F09000}Uptime${color #707070}:$color $uptime
${color #F09000}Load${color #707070}:$color $loadavg
${color #F09000}Battery${color #707070}:${color white} ${execi 15 /usr/bin/bat.pl}% ${color white} ${execibar 15 /usr/bin/bat.pl}
${color #F09000}CPU${color #707070}:${color white} ${cpu}% ${freq}MHz ${color #F09000}Temp${color #707070}:$color ${acpitemp} F${color grey}
${cpugraph 000000 5000a0}
${color #F09000}Memory${color #707070}:${color white} ${memperc}% $mem/$memmax
${memgraph 000000 5000a0}
background no
update_interval 1.0
double_buffer yes
use_xft no
xftfont Monospace:size=10
xftalpha 0.8
own_window yes
own_window_transparent yes
own_window_type override
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#on_bottom yes
minimum_size 250 42
draw_shades no
draw_outline yes
draw_borders no
draw_graph_borders no
stippled_borders 0
border_margin 0
border_width 0
default_color white
default_shade_color black
default_outline_color black
alignment top_left
gap_x 332
gap_y 875
#gap_y 10
no_buffers yes
TEXT
${color white}Processes
${hr}
${color}Name PID CPU% MEM%
${color #ddaa00} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
${color}Mem usage
${color #ddaa00} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${color lightgrey} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${color lightgrey} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
${color lightgrey} ${top_mem name 4} ${top_mem pid 4} ${top_mem cpu 4} ${top_mem mem 4}
background no
update_interval 1.0
double_buffer yes
use_xft no
xftfont Monospace:size=10
xftalpha 0.8
own_window yes
own_window_transparent yes
own_window_type override
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#on_bottom yes
minimum_size 275 42
draw_shades no
draw_outline yes
draw_borders no
draw_graph_borders no
stippled_borders 0
border_margin 0
border_width 0
default_color white
default_shade_color black
default_outline_color black
alignment top_left
gap_x 580
gap_y 875
#gap_y 10
no_buffers yes
TEXT
Networking
${hr}
${color #F09000}wlan0${color #707070}:${color white} ${addr wlan0}
${color #F09000}Downspeed${color #707070}: ${color white}${downspeed wlan0}k ${color #F09000}Upspeed${color #707070}: ${color white}${upspeed wlan0}k
${color black}${downspeedgraph wlan0 30,90 000000 5000a0} $alignr${color black}${upspeedgraph wlan0 30,90 000000 5000a0}
${color #F09000}eth0${color #707070}:${color white} ${addr eth0}
${color #F09000}Downspeed${color #707070}: ${color white}${downspeed eth0}k ${color #F09000}Upspeed${color #707070}: ${color white}${upspeed eth0}k
${color black}${downspeedgraph eth0 30,90 000000 5000a0} $alignr${color black}${upspeedgraph eth0 30,90 000000 5000a0}
background no
update_interval 1.0
double_buffer yes
use_xft no
xftfont Monospace:size=10
xftalpha 0.8
own_window yes
own_window_transparent yes
own_window_type override
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#on_bottom yes
minimum_size 415 42
draw_shades no
draw_outline yes
draw_borders yes
draw_graph_borders no
stippled_borders 0
border_margin 0
border_width 0
default_color white
default_shade_color black
default_outline_color black
alignment top_left
gap_x 855
gap_y 875
#gap_y 10
no_buffers yes
TEXT
${color white}File Systems
${hr}
${if_mounted /}${color #F09000}/${color #707070}: $color${fs_used /}/${fs_size /} ${color #F09000}Free${color #707070}: $color${fs_free /} ${fs_bar /}$endif
${if_mounted /media/Elements}${color #F09000}Elements${color #707070}: $color${fs_used /media/Elements}/${fs_size /media/Elements} ${color #F09000}Free${color #707070}: $color${fs_free /media/Elements} ${fs_bar /media/Elements}$endif
${if_mounted /media/data}${color #F09000}data${color #707070}: $color${fs_used /media/data}/${fs_size /media/data} ${color #F09000}Free${color #707070}: $color${fs_free /media/data} ${fs_bar /media/data}$endif
${if_mounted /media/host}${color #F09000}host${color #707070}: $color${fs_used /media/host}/${fs_size /media/host} ${color #F09000}Free${color #707070}: $color${fs_free /media/host} ${fs_bar /media/host}$endif
${if_mounted /media/studio}${color #f09000}studio${color #707070}: $color${fs_used /media/studio}/${fs_size /media/studio} ${color #F09000}Free${color #707070}: $color${fs_free /media/studio} ${fs_bar /media/studio}$endif
${if_mounted /media/elements}${color #f09000}elements${color #707070}: $color${fs_used /media/elements}/${fs_size /media/elements} ${color #F09000}Free${color #707070}: $color${fs_free /media/elements} ${fs_bar /media/elements}$endif
${if_mounted /mnt/ubuntu}${color #F09000}ubuntu${color #707070}: $color${fs_used /mnt/ubuntu}/${fs_size /mnt/ubuntu} ${color #F09000}Free${color #707070}: $color${fs_free /mnt/ubuntu} ${fs_bar /mnt/ubuntu}$endif
I put the 4 files in my home directory and named them
.conkyrc
.conkyrctop
.conkyrcnet
.conkyrcfile
I use the following bash script to start them all
#!/bin/bash
conky -c ~/.conkyrc &
conky -c ~/.conkyrctop &
conky -c ~/.conkyrcnet &
conky -c ~/.conkyrcfile &
Only the script needs to be executable. Also the files are sized for 1280x1024 so if you use a different resolution you will have to change gap_y values and minimum_size values to accomodate.
Last edited by empthollow (2010-07-08 19:06:59)
Similar Messages
-
OBIEE 11g How to Exclude/Include Multiple columns on BI Report at Run Time
OBIEE 11g How to Exclude/Include Multiple columns on BI Report at Run Time
Exclude:
you Can exclude columns in either Table view or pivot table view by placing those columns in Excluded section but you will notice that it will appear in bi server parsed sql query.
Not sure you were asking about runtime??
would you please explain your question!!
Thanks
NK
Edited by: DNK on May 8, 2013 9:48 PM -
Multiple Column Report Question
Post Author: LCS213
CA Forum: Crystal Reports
I'm creating a student transcript report that has multiple columns, and is three groups deep. The first two groups need to be in a columnar layout. However, I'd like the third group to contain a subreport that spans the width of the entire page.
Are there any options within Crystal XI to do this? I know in the Section Expert, i can format the detail level with multiple columns, and on the Layout tab, I can select "Format Groups with multiple columns". But that seems like it either formats ALL groups or NO groups. Am I mistaken? Is there a workaround I'm missing?
Thanks in advance for any help on this issue!Hi Dan,
According to your description, we are not clear about the “6 sections for each Additional task”. Do you mean six data records? If so, based on my understanding, there are three groups and eighteen records in your report. You want to make those records appear
on eighteen separated pages, right?
In Reporting Service, we can add a page break to groups within data regions to control the amount of information on each page. In your scenario, you should add page break to group “Sub task”, group “Additional Task” and details. As we tested in our environment,
add page break to these records, the report appears in eighteen pages. Please refer to steps below:
1.On Group Properties of Details1, choose “Between each instance of a group” option on Page Breaks page. Please refer to screenshot below:
Choose same option on Group Properties for group “Month” and “Name”.
2.Click drop-down button next to Column Groups, then choose Advanced Mode.
3.Click on Static under Row Groups, set RepeatOnNewPage as True in Tablix Member Properties.
4.Click Preview, the results before and after adding page break look like below:
If you still have any question, please post some detail information or screenshot about the report design you expect.
Best regards,
Qiuyun Yu -
Index on multiple columns issue Oracle 9i
Hi,
I have a couple of issues and would appreciate it if anyone can help:
a). I have a table that has indexes on multiple columns, so for example:
Index 1 on Org_Type, Org_Id and Effdt
Index 2 on FICE_CD, Org_Id and Effdt etc.
I have 9 such indexes and all of them hav Effdt in it.
My question is if I query the table and always use a subquery to get the max Effdt rows form the table, will the above indexes help in my query or will I have to create another index just on Effdt so that my Query runs faster.
b). I have a target table with more than 20 million rows in it. This table has an Effdt too and I would like to find the max effdted row in this table as well so that I can then use that date-time stamp in my ETL tool to do an incremental update from my source table each night. But since the amount of rows is huge, my query runs forever. I have a normal non-unique index on Effdt. Is there another way I can optimize this table? Currenlty I have resorted to getting all rows from source that are >= (sysdate -1), but I would prefer to get the max date-time stamp from the target table itself.
Thanks,
CJHi ,
Thanks for the input. I just used the explain plan and found that there is a full table scan happening on the PS_EXT_ORG_TBL, so I guess I will have to create an index specifically on the effdt field. The sql is as follows:
Select E.EMPLID, E.INSTITUTION, E.EXT_ORG_ID, E.EXT_CAREER, E.EXT_DATA_NBR, E.EXT_SUMM_TYPE, E.UNT_ATMP_TOTAL, E.UNT_COMP_TOTAL,
E.CLASS_RANK, E.CLASS_SIZE, E.PERCENTILE, E.UM_GPA_EXCLUDE, E.UM_EXT_ORG_GPA, E.CONVERT_GPA,
E.UM_EXT_ORG_CNV_CR, E.UM_EXT_ORG_CNV_GPA, E.UM_EXT_ORG_CNV_QP, E.UM_GPA_OVERRIDE, E.EXT_ACAD_LEVEL,
F.FROM_DT, F.TO_DT, G.EXT_DEGREE_NBR, G.DEGREE, G.DESCR "DEGREE DESCR", G.DEGREE_DT, H.EFFDT,
H.EFF_STATUS, H.SCHOOL_CODE, H.LS_SCHOOL_TYPE, H.ATP_CD, H.CITY, H.STATE, H.COUNTRY,
H.DESCR "SCHOOL DESCR", H.PROPRIETORSHIP
FROM PS_EXT_ACAD_SUM E, PS_EXT_ACAD_DATA F, PS_EXT_DEGREE G, PS_EXT_ORG_TBL H
WHERE E.EXT_ORG_ID = F.EXT_ORG_ID AND E.EMPLID = F.EMPLID
AND E.EXT_ORG_ID = G.EXT_ORG_ID AND E.EMPLID = G.EMPLID
AND E.EXT_ORG_ID = H.EXT_ORG_ID
AND H.EFFDT=(SELECT MAX(EFFDT) FROM PS_EXT_ORG_TBL H1
WHERE H.EXT_ORG_ID=H1.EXT_ORG_ID
AND H.EFF_STATUS=H1.EFF_STATUS
AND H.SCHOOL_CODE=H1.SCHOOL_CODE
AND H.LS_SCHOOL_TYPE=H1.LS_SCHOOL_TYPE
AND H.ATP_CD=H1.ATP_CD
AND H.CITY=H1.CITY
AND H.STATE=H1.STATE )
My source DB is a copy of the transactional database, so there is no danger of new rows coming in. -
Workshop Weblogic config questions
I'm using Oracle Workshop for WebLogic 10.3 and I'm hoping someone can answer some setup/config questions.
When I double click on the server (WebLogic Server v10.3 at localhost) a window opens with various settings that manage how workshop and weblogic work together.
Under "Startup & Deployment" I have the following turned on:
Launch WebLogic server in Eclipse console
Always start WebLogic Server in debug mode
Ignore project compilation errors when publishing (I have this turned on because of errors in a portal project, the errors aren't inmportant, and don't prevent the project form running)
Run stand-alone web module directly from workspace
So, first question, with these settings I was able to quickly switch to debug mode, with out restarting the server, now the server restarts whenever I turn debugging on. What have I done that has stopped this working correctly? How can I get it to start debugging without a full restart?
next question, what happens if I turn on "Start WebLogic Server in Express Mode"? As far as I can tell nothing happens.
Lastly, under "Automatic Publishing" I have it set to "Never publish automatically", if I choose another setting workshop essentially freezes because it's constantly publishing. So whenever I make a change, even in a jsp, I need to remove the project, then re-add it to see my changes in the browser. This is frustrating, not just because it takes 8 or 9 minutes (8 or 9 MINUTES!!!), but because the project doesn't run properly until it is redeployed. You'd think that if it needs to be re-deployed, then none of my changes should matter on the server until it is re-deployed.
So, my question is, Is there any way to get this re-deployment to happen faster?
Thanks for any and all helpWell, in my experience performance is not bad as you experienced. Is it locally connected server or remotely connected server? If it is a remote server, network issue could cause this latency issue.
Is performance better if you run the server without enabling debug mode? If yes, probably you can also review any break points set.
You could also try out the following options
1) Run workshop with -clean option, by opening command prompt and navigating to workshop_home\'workshop.exe -clean'
2) Untick the option 'Launch WebLogic server in Eclipse console' and start server which would enable server to start on command prompt
3) This would enable you to take multiple thread dumps (cutl +Break) on the server console output, while performance is very bad, to see where threads are halt. -
A few post config questions on new setup
Hi Group,
Just a few post config questions.
First, how can I confirm my controller is in fact associating properly with an NTP server? On a typically cisco product, I could just do a 'show ntp associations' or a 'show ntp status'. I cannot see a way to confirm this on the gui or command line.
Second, on my guest network with web-auth, if one were to choose to not use https for web-auth and instead use unsecure http, would that be possible and if so where in the gui?
Thanks.The third field is from a WLC running v7.4 not v7.2. I usually would install a 3rd party certificate, but what eles you can try is issue this command on from the CLI. It had issues working with certain code versions, but you might as well give it a try.
config network web-auth secureweb disable
Thanks,
Scott
Help out other by using the rating system and marking answered questions as "Answered" -
(Using WiFi and all-- library computers, etc.. I got in the habit of keeping multiple tabs open. I came to Firefox because it handled that usage much, much better than any version of IE. Running the multiple tabs of the future television listings made sense and Was very convenient.. Was. Now it seems -after eliminating other possibilities* that the TitanTV page is the cause of my Firefox Hanging.. (when open at all It slows even Other pages' scrolling..?! ) So yeah-- 'Hanging,' unresponsive page, flash/shockwave -type crashes etc. ,etc. Obviously..I don't Have to use the page.. or run it on this browser but What ALL Of A Sudden is causing this to occur?? Is it the ad content on there somehow? I'd love to find out at this point... and I do prefer this to the other browsers. [*And did follow the posted usual troubleshoots as well as uninstall/re-install on both the Firefox and antivirus (Avast), clearing the cache memory...] I'd love it if I could solve this new mystery here.... Thanks! )
Tom, <br />
I am glad it is working again after following Moses's advice.
You say give us volunteers better ammunition, would help with troubleshooting. Well one thing you could have done along those lines was to follow the prompts to include full troubleshooting information in your question.
You have marked the thread solved and so it appears running in safe mode with plugins disabled solved the issue for you. That is commonly seen in searches as a troubleshooting step because it is useful. Firefox is highly customisable something people like, but the downside is all the various addons do not always work well in every situation and combination.
The action was only intended as a troubleshooting step, but you may well have more than one single issue here and may need further help sorting that out. I appreciate you are frustrated & not swearing '''at''' ''Moses'' but you are probably more likely to find help if you tone down the language.
I can not be sure yet but probably most of you problems are not directly related to the upgrade of Firefox from Fx28 to Fx29. -
How to calculate the individual sums of multiple columns in a single query
Hello,
Using Oracle 11gR2 on windows 7 client. I have a question on calculating sum() on multiple columns on different columns and store the results in a view. Unfortunately I could not post the problem here as it keeps on giving error "Sorry, this content is not allowed", without telling where or what it is! So I had to post it in the stack-overflow forum, here is the link: http://stackoverflow.com/questions/16529721/how-to-calculate-the-individual-sums-of-multiple-columns-in-a-single-query-ora
Will appreciate any help or suggestion.
Thanksuser13667036 wrote:
Hello,
Using Oracle 11gR2 on windows 7 client. I have a question on calculating sum() on multiple columns on different columns and store the results in a view. Unfortunately I could not post the problem here as it keeps on giving error "Sorry, this content is not allowed", without telling where or what it is! So I had to post it in the stack-overflow forum, here is the link: http://stackoverflow.com/questions/16529721/how-to-calculate-the-individual-sums-of-multiple-columns-in-a-single-query-ora
Will appreciate any help or suggestion.
ThanksLooks like you want a simple group by.
select
yr
, mnth
, region
, sum(handled_package)
, sum(expected_missing_package)
, sum(actual_missing_package)
from test
group by
yr, mnth, region
order by
yr, mnth, region;I wouldn't recommend storing your data for year / month in 2 columns like that unless you have a really good reason. I would store it as a date column and add a check constraint to ensure that the date is always the first of the month, then format it out as you wish to the client.
CREATE TABLE test
year_month date,
Region VARCHAR2(50),
CITY VARCHAR2(50),
Handled_Package NUMBER,
Expected_Missing_Package NUMBER,
Actual_Missing_Package NUMBER
alter table test add constraint firs_of_month check (year_month = trunc(year_month, 'mm'));
ME_XE?Insert into TEST (year_month, REGION, CITY, HANDLED_PACKAGE, EXPECTED_MISSING_PACKAGE, ACTUAL_MISSING_PACKAGE)
2 Values (to_date('2012-nov-12', 'yyyy-mon-dd'), 'Western', 'San Fransisco', 200, 10, 5);
Insert into TEST (year_month, REGION, CITY, HANDLED_PACKAGE, EXPECTED_MISSING_PACKAGE, ACTUAL_MISSING_PACKAGE)
ERROR at line 1:
ORA-02290: check constraint (TUBBY.FIRS_OF_MONTH) violated
Elapsed: 00:00:00.03
ME_XE?Insert into TEST (year_month, REGION, CITY, HANDLED_PACKAGE, EXPECTED_MISSING_PACKAGE, ACTUAL_MISSING_PACKAGE)
2 Values (to_date('2012-nov-01', 'yyyy-mon-dd'), 'Western', 'San Fransisco', 200, 10, 5);
1 row created.
Elapsed: 00:00:00.01
ME_XE?select
2 to_char(year_month, 'fmYYYY') as year
3 , to_char(year_month, 'fmMonth') as month
4 , Region
5 , CITY
6 , Handled_Package
7 , Expected_Missing_Package
8 , Actual_Missing_Package
9 from test;
YEAR MONTH REGION CITY HANDLED_PACKAGE EXPECTED_MISSING_PACKAGE ACTUAL_MISSING_PACKAGE
2012 November Western San Fransisco 200 10 5
1 row selected.
Elapsed: 00:00:00.01
ME_XE?Then you have nice a nice and easy validation that ensures you data integrity.
Cheers, -
How to get a distinct count of multiple columns
I've done this before and I'll be darned why I can't recall this.
Table with 3 columns with the primary key defined in column a.
Row a b c
num.
1 020 how abc
2 030 why def
3 010 not ghi
4 040 how abc
5 050 yes def
6 060 why def
So what I want is a count of the unique values for columns b and c as if b and c were actually one field.
So the result of the query would be:
Count = 4 unique rows.
Hopefully I'm making some sort of sense. It's a bit much to ask about the number of occurrences of each duplicate value, I'm sure just getting count of the unique rows of the non-indexed rows will be sufficient. Since the query is meant to be universal for multiple columns of numeric and alphanumeric data and can be expanded for multiple columns, I am simply trying to get a basic skeleton that works for an "on the fly" analysis.Thanks to all of you. I had the idea and just couldn't nail it down. You did it.
All of you understood what I poorly communicated. My apologies for the lack of prep with a table, I was running patches on the system and couldn't dare interrupt it on my laptop and starting Oracle 11 while Micro$lop was patching all sorts of evil code. This is something I'm setting up on my own time so it's a work I'm going to try to be proud of. So there will be plenty of instrumentation and debugging code for timing.
I'd thought of concatenating columns and was worried it wouldn't backport to older Oracle versions (work goes back to 8.1.7) with nulls and other goofy things like long raw fields or lob/clobs plus the other DBs that are at various sites. What I'm trying to do is improve on a crappy data analysis tool SAP provides to use with reporting unique columns. (Basis people could recognize this as DB05). I tried dragging out the SQL that their ABAP/4 language generates from an SQL trace but it was unusable and often dies on internal storage which on most sites is about 4GB per process. Needless to say, the program is wasteful and I'm trying to keep the work on the DB where it belongs and discourage cowboys from doing this in the DB on the fly and at the same time make it simpler for junior members to use while having a semblance of an audit trail.
What I'm trying to do is work out a tool that checks all the crappy secondary indexes that were created by folks who seem to think in ways that are from an alien species not yet speculated about even with the strongest psychedelics. One of them actually decreases performance by a minimum factor of 5. It's not much when it's 5 seconds but when the response time averages about 3 hours beforehand, you can imagine what it was like afterward. In this particular case, the "logic" was that the index needed to be defined by the order of the fields of the select clause. Some myths never die. So it's not easy to work out which ones haven't been used in a long time, so it's down to finding which of the custom ones are actually bad in terms of selectivity. Some of these may have made a little bit of sense when the system was started up, now that some of these have millions of rows instead of a few thousand, thaw tend to expose the flaws in design.
I'm also trying to make this work on multiple DBs such as DB2, MaxDB and (sob) SQL Squealer. The idea is to write this in ABAP code as a utility without the overhead of internal tables in ABAP as some of these tables are many millions of rows and I have to account for the size in memory. (ABAP field sizes in internal memory are generally much larger than the actual DB lengths. so every bit helps!) So I'm trying to create actual SQL on the fly and use it internally without going through the SAP DB interface which limits the type of SQL functions used and all the overhead. It's intended to grab a secondary index and if there are more than 2 fields defined, work it backwards to show unique values for all columns, all columns - 1, all columns - 2 and so on back to the initial column in the index.
Why does this seem important? On Oracle I can generate histograms but those can often screw up SAP. On other DBs, the indexing cardinality is much more important, particularly with DB optimizers that make some odd decisions. So I need evidence I can push to folks who will only understand if there's a plain and simple analysis that explains it (almost) in crayon.
I'm testing null values next (which worked!) but these suggestions all seem to follow the same idea which won't work in ABAP without some serious memory issues. So I'm down to this type of coding:
exec sql.
<dynamically generated true SQL>
end-exec.
rather than using ABAP with their concept of "open SQL" and the DB interface with all the overhead.
RB's suggestion of the UNION ALL wasn't quite what I was looking for BUT it made me think that this would be a nice enhancement for evaluations!
So the candidates that seem to work for what I wanted are as follows:
SQL> SELECT COUNT (MIN (0)) AS distinct_col3_col4_cnt
2 from rb group by b, c;
DISTINCT_COL3_COL4_CNT
7
select count(distinct(b || c)) num_rows from rb;
So thanks also to Frank, APNL and Nimesh for their examples. Now the fun starts as I spec out the processing. -
Top N Analysis with multiple columns
Hi
I am using Oracle 9i. I do have a table which contains datewise promotional material types for an organisation.
The structure is as follows:
CREATE TABLE TEST
(CDATE DATE,
BROCHURE VARCHAR2(1),
WEBSITE VARCHAR2(1),
DIRECT_MAIL VARCHAR2(1),
PRESS_RELEASE VARCHAR2(1),
JOURNAL_AD VARCHAR2(1)
and the sample data is as follows:
CDate Brochure Website Direct_Mail Press_Release Journal_Ad
01/04/1996 Y Y Y N N
02/04/1996 Y Y N N N
23/06/1996 Y N Y Y N
13/09/1996 Y Y N N N
01/04/1997 Y Y N N N
02/04/1997 Y Y Y N Y
23/06/1997 N Y N N Y
13/09/1997 Y Y N N N
01/04/1998 Y Y Y N N
02/04/1998 Y N N Y N
23/06/1998 N Y N N Y
13/09/1998 Y Y N N Y
01/04/1999 Y Y Y N Y
02/04/1999 Y N N Y N
23/06/1999 N Y N N N
13/09/1999 Y Y Y N N
I want to have year wise top 4 promotional types in terms of count of 'Y' only. The result should be like as follows:
YEAR:1996
TYPE COUNT
BROCHURE 4
WEBSITE 3
DIRECT_MAIL 2
PRESS_RELEASE 1
JOURNAL_AD 0
YEAR:1997
TYPE COUNT
WEBSITE 4
BROCHURE 3
JOURNAL_AD 2
DIRECT_MAIL 1
PRESS_RELEASE 1
Please suggest a solution for the same. I am not able to sort it for multiple columns.
Regards
MSOne of the questions that must be asked when you have a requirement to only show the top N ranked items in a list, is "what about a tie in the ranking?".
Oracle has two ranking functions that allow you to deal with either requirement - RANK and DENSE_RANK. Both operate as either analytic or aggregate functions, so either will work for your requirements. The previous posting by Miguel demonstrated how to decode your Y/N flags and pivot the data.
In this example, I've taken the liberty of adding some data to year 2000 that will show the difference between RANK and DENSE_RANK as well as how to use them to filter your results.
First, here's the decoded/pivoted data:
SQL>WITH test AS
2 ( SELECT TO_DATE('01/04/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
3 UNION ALL SELECT TO_DATE('02/04/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
4 UNION ALL SELECT TO_DATE('23/06/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
5 UNION ALL SELECT TO_DATE('13/09/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
6 UNION ALL SELECT TO_DATE('01/04/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
7 UNION ALL SELECT TO_DATE('02/04/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
8 UNION ALL SELECT TO_DATE('23/06/1997','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
9 UNION ALL SELECT TO_DATE('13/09/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
10 UNION ALL SELECT TO_DATE('01/04/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
11 UNION ALL SELECT TO_DATE('02/04/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'N' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
12 UNION ALL SELECT TO_DATE('23/06/1998','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
13 UNION ALL SELECT TO_DATE('13/09/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
14 UNION ALL SELECT TO_DATE('01/04/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
15 UNION ALL SELECT TO_DATE('02/04/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'N' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
16 UNION ALL SELECT TO_DATE('23/06/1999','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
17 UNION ALL SELECT TO_DATE('13/09/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
18 UNION ALL SELECT TO_DATE('01/04/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
19 UNION ALL SELECT TO_DATE('02/04/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
20 UNION ALL SELECT TO_DATE('23/06/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
21 UNION ALL SELECT TO_DATE('13/09/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
22 )
23 SELECT cyear
24 ,ctype
25 ,RANK() OVER (PARTITION BY cyear ORDER BY num_media DESC) ranking
26 ,DENSE_RANK() OVER (PARTITION BY cyear ORDER BY num_media DESC) dense_ranking
27 FROM (SELECT TRUNC(CDATE,'Y') CYEAR
28 ,'BROCHURE' CTYPE, SUM(DECODE(BROCHURE, 'Y', 1, 0)) NUM_MEDIA
29 FROM test
30 GROUP BY TRUNC(CDATE,'Y')
31 UNION ALL
32 SELECT TRUNC(CDATE,'Y') CYEAR
33 ,'WEBSITE' CTYPE, SUM(DECODE(WEBSITE, 'Y', 1, 0))
34 FROM test
35 GROUP BY TRUNC(CDATE,'Y')
36 UNION ALL
37 SELECT TRUNC(CDATE,'Y') CYEAR
38 ,'DIRECT_MAIL' CTYPE, SUM(DECODE(DIRECT_MAIL, 'Y', 1, 0))
39 FROM test
40 GROUP BY TRUNC(CDATE,'Y')
41 UNION ALL
42 SELECT TRUNC(CDATE,'Y') CYEAR
43 ,'PRESS_RELEASE' CTYPE, SUM(DECODE(PRESS_RELEASE, 'Y', 1, 0))
44 FROM test
45 GROUP BY TRUNC(CDATE,'Y')
46 UNION ALL
47 SELECT TRUNC(CDATE,'Y') CYEAR
48 ,'JOURNAL_AD' CTYPE, SUM(DECODE(JOURNAL_AD, 'Y', 1, 0))
49 FROM test
50 GROUP BY TRUNC(CDATE,'Y')
51 )
52* order by cyear desc, ranking
53 /
CYEAR CTYPE RANKING DENSE_RANKING
01-Jan-2000 00:00:00 BROCHURE 1 1
01-Jan-2000 00:00:00 WEBSITE 1 1
01-Jan-2000 00:00:00 DIRECT_MAIL 3 2
01-Jan-2000 00:00:00 PRESS_RELEASE 4 3
01-Jan-2000 00:00:00 JOURNAL_AD 5 4
01-Jan-1999 00:00:00 BROCHURE 1 1
01-Jan-1999 00:00:00 WEBSITE 1 1
01-Jan-1999 00:00:00 DIRECT_MAIL 3 2
01-Jan-1999 00:00:00 PRESS_RELEASE 4 3
01-Jan-1999 00:00:00 JOURNAL_AD 4 3
01-Jan-1998 00:00:00 BROCHURE 1 1
01-Jan-1998 00:00:00 WEBSITE 1 1
01-Jan-1998 00:00:00 JOURNAL_AD 3 2
01-Jan-1998 00:00:00 DIRECT_MAIL 4 3
01-Jan-1998 00:00:00 PRESS_RELEASE 4 3
01-Jan-1997 00:00:00 WEBSITE 1 1
01-Jan-1997 00:00:00 BROCHURE 2 2
01-Jan-1997 00:00:00 JOURNAL_AD 3 3
01-Jan-1997 00:00:00 DIRECT_MAIL 4 4
01-Jan-1997 00:00:00 PRESS_RELEASE 5 5
01-Jan-1996 00:00:00 BROCHURE 1 1
01-Jan-1996 00:00:00 WEBSITE 2 2
01-Jan-1996 00:00:00 DIRECT_MAIL 3 3
01-Jan-1996 00:00:00 PRESS_RELEASE 4 4
01-Jan-1996 00:00:00 JOURNAL_AD 5 5You can see that in year 2000 there is a tie for first place (ranking #1). The RANK function will name the second highest count 3 (skipping the rank of 2 due to the tie), while the DENSE_RANK function will not skip a ranking.
Now, to filter on the ranking, wrap your query in another in-line view like this - but use which ever ranking function YOUR requirements call for:
SQL>WITH test AS
2 ( SELECT TO_DATE('01/04/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
3 UNION ALL SELECT TO_DATE('02/04/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
4 UNION ALL SELECT TO_DATE('23/06/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
5 UNION ALL SELECT TO_DATE('13/09/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
6 UNION ALL SELECT TO_DATE('01/04/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
7 UNION ALL SELECT TO_DATE('02/04/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
8 UNION ALL SELECT TO_DATE('23/06/1997','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
9 UNION ALL SELECT TO_DATE('13/09/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
10 UNION ALL SELECT TO_DATE('01/04/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
11 UNION ALL SELECT TO_DATE('02/04/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'N' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
12 UNION ALL SELECT TO_DATE('23/06/1998','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
13 UNION ALL SELECT TO_DATE('13/09/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
14 UNION ALL SELECT TO_DATE('01/04/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
15 UNION ALL SELECT TO_DATE('02/04/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'N' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
16 UNION ALL SELECT TO_DATE('23/06/1999','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
17 UNION ALL SELECT TO_DATE('13/09/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
18 UNION ALL SELECT TO_DATE('01/04/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
19 UNION ALL SELECT TO_DATE('02/04/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
20 UNION ALL SELECT TO_DATE('23/06/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
21 UNION ALL SELECT TO_DATE('13/09/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
22 )
23 SELECT * FROM (
24 SELECT cyear
25 ,ctype
26 ,RANK() OVER (PARTITION BY cyear ORDER BY num_media DESC) ranking
27 ,DENSE_RANK() OVER (PARTITION BY cyear ORDER BY num_media DESC) dense_ranking
28 FROM (SELECT TRUNC(CDATE,'Y') CYEAR
29 ,'BROCHURE' CTYPE, SUM(DECODE(BROCHURE, 'Y', 1, 0)) NUM_MEDIA
30 FROM test
31 GROUP BY TRUNC(CDATE,'Y')
32 UNION ALL
33 SELECT TRUNC(CDATE,'Y') CYEAR
34 ,'WEBSITE' CTYPE, SUM(DECODE(WEBSITE, 'Y', 1, 0))
35 FROM test
36 GROUP BY TRUNC(CDATE,'Y')
37 UNION ALL
38 SELECT TRUNC(CDATE,'Y') CYEAR
39 ,'DIRECT_MAIL' CTYPE, SUM(DECODE(DIRECT_MAIL, 'Y', 1, 0))
40 FROM test
41 GROUP BY TRUNC(CDATE,'Y')
42 UNION ALL
43 SELECT TRUNC(CDATE,'Y') CYEAR
44 ,'PRESS_RELEASE' CTYPE, SUM(DECODE(PRESS_RELEASE, 'Y', 1, 0))
45 FROM test
46 GROUP BY TRUNC(CDATE,'Y')
47 UNION ALL
48 SELECT TRUNC(CDATE,'Y') CYEAR
49 ,'JOURNAL_AD' CTYPE, SUM(DECODE(JOURNAL_AD, 'Y', 1, 0))
50 FROM test
51 GROUP BY TRUNC(CDATE,'Y')
52 )
53 )
54 where RANKING <= 4
55* order by cyear desc, ranking
56 /
CYEAR CTYPE RANKING DENSE_RANKING
01-Jan-2000 00:00:00 WEBSITE 1 1
01-Jan-2000 00:00:00 BROCHURE 1 1
01-Jan-2000 00:00:00 DIRECT_MAIL 3 2
01-Jan-2000 00:00:00 PRESS_RELEASE 4 3
01-Jan-1999 00:00:00 BROCHURE 1 1
01-Jan-1999 00:00:00 WEBSITE 1 1
01-Jan-1999 00:00:00 DIRECT_MAIL 3 2
01-Jan-1999 00:00:00 JOURNAL_AD 4 3
01-Jan-1999 00:00:00 PRESS_RELEASE 4 3
01-Jan-1998 00:00:00 BROCHURE 1 1
01-Jan-1998 00:00:00 WEBSITE 1 1
01-Jan-1998 00:00:00 JOURNAL_AD 3 2
01-Jan-1998 00:00:00 PRESS_RELEASE 4 3
01-Jan-1998 00:00:00 DIRECT_MAIL 4 3
01-Jan-1997 00:00:00 WEBSITE 1 1
01-Jan-1997 00:00:00 BROCHURE 2 2
01-Jan-1997 00:00:00 JOURNAL_AD 3 3
01-Jan-1997 00:00:00 DIRECT_MAIL 4 4
01-Jan-1996 00:00:00 BROCHURE 1 1
01-Jan-1996 00:00:00 WEBSITE 2 2
01-Jan-1996 00:00:00 DIRECT_MAIL 3 3
01-Jan-1996 00:00:00 PRESS_RELEASE 4 4 -
Hi,
in sapgui java 7.10 (on mac osx 10.5.1) I cannot select multiple columns in ALV reports.
I can do it only in some transactions (like SE16). But on all our custom reports (REUSE_ALV_GRID_DISPLAY) in does not work.
Any hint?
Many thanks,
LorenzoHi Lorenzo,
did you double check if selecting multiple columns works with SAP GUI for Windows in the same report?
If yes, I suggest to file a bug report so we can do a remote logon to run your custom report.
If not it might be because of REUSE_ALV_GRID_DISPLAY itself or your parameters calling REUSE_ALV_GRID_DISPLAY.
Best regards
Rolf-Martin -
How can I display multiple column results of a sql query?
I'm wanting to display the results of a query selecting from multiple columns, but I can't seem to find an item type that will allow this. I've tried LOV, multiselect, display as text and others. Any ideas on how to do this. Here is my basic query:
Select ul.meaning,
rqa.submission_date,
rqa.location_num
from
cfa_rqa_doc_submit_dates rqa,
cfa_user_lookups ul
where
rqa.location_num in (Select location_num from cfa_current_locations_mv
where operator_person_id = :P1_PERSON_ID and substr(location_num,1,1) = '8')
and
ul.lookup_type_id='1269'
and
to_char(rqa.submission_date, 'month') = to_char(sysdate, 'month')
and
rqa.submission_date >= (SYSDATE-365)
and ul.lookup_ID= rqa.document_type_id
;Hi,
Do you just wish to display the result of the query? If so, you can simply parse it out in HTML.
You can then choose if you want to use tables or css.
Multiple column layout in tables are based on <tr> and <td>.
<tr> is a table row, where <td> is a column.
All tags should be closed.
Example:
<table>
<tr>
<td>col1</td><td>col2</td>
</tr>
<tr>
<td colspan="2">spans over 2 cols</td>
</tr>
</table>If you want to do the same in css:
(Seems this forum removes the styles!):
float:left; width:50; << first div and 2 div (col 1 and col 2 style)
float:left;clear:both; width:100%; << clear both, double width (spans over 2)
<div>
<div style="float:left; width:50;">col1</div><div style="float:left;width:50%;">col2</div>
<div style="float:left;clear:both; width=100%;">Spans over 2 cols</div>
</div>The div might look more complicated, but if you refrain from styling in the tags them selves, you can define different styles in the .css file.
You need the clear:both to start a new line with the divs that float.
I usually run a dedicated "new line" div, without content.. (exception beeing the html-entities version of ' ' (& nbsp ; << without the spaces)).
eg.:
<div style="cls"> </div>Parsing out the values from the PL SQL you do like so:
begin
declare
cursor c_search is
Select ul.meaning,
rqa.submission_date,
rqa.location_num
from
cfa_rqa_doc_submit_dates rqa,
cfa_user_lookups ul
where
rqa.location_num in (Select location_num from cfa_current_locations_mv
where operator_person_id = :P1_PERSON_ID and substr(location_num,1,1) = '8')
and
ul.lookup_type_id='1269'
and
to_char(rqa.submission_date, 'month') = to_char(sysdate, 'month')
and
rqa.submission_date >= (SYSDATE-365)
and ul.lookup_ID= rqa.document_type_id
begin
htp.p('<div style="width:80%;">');
for v_search in c_search loop
htp.p('<div style="float:left;clear:none;">'||v_search.location_num||'</div>');
htp.p('<div style="float:left;clear:none;">'||v_search.submission_date||'</div>');
end loop;
htp.p('</div>');
end;
end;Ps. hope I understood you correctly, also this code is untested.. but I hope it can still help.
Edited by: Olav Alexander Mjelde on May 12, 2010 9:36 AM -
Multiple columns and rows in MessageService
I am attempting to create a message (via MessageService) which has multiple lines of data, and each line has multiple data columns.
Background: My program reads data from a web store, and creates Sales Orders in SBO. A single run might process multiple orders. When all orders have been entered, the program should send a (single) message to a list of recipients. The message will have one line of data for each sales order produced. Each line will contain two fields: the linked SBO sales order number, and the unlinked web order number.
When the message is initially created, I'm defining the multiple columns and initializing the data lines:
pMessageDataColumns = oMessage.MessageDataColumns
pMessageDataColumn = pMessageDataColumns.Add()
pMessageDataColumn.ColumnName = "SalesOrder"
pMessageDataColumn.Link = BoYesNoEnum.tYES
pMessageDataColumn = pMessageDataColumns.Add()
pMessageDataColumn.ColumnName = "WebOrder"
pMessageDataColumn.Link = BoYesNoEnum.tNO
oLines = pMessageDataColumn.MessageDataLines()
Later, as each Sales Order is processed, I'm attempting to inject the two data values into the message data:
oLine = oLines.Add()
oLine.Value = Str(pOrd.DocNum)
oLine.Object = 17
oLine.ObjectKey = Str(pOrd.DocEntry)
oLine = oLines.Add()
oLine.Value = pOrd.WebOrder
The above code would be invoked for each Sales Order processed. However, it generates an "Internal error (-5002) occurred" when the message is ultimately sent.
The SDK documentation states:
The MessageDataLine is a child data structure related to the MessageDataColumn. It contains the value of a specified cell in the Data table, which is defined by its column number (vtIndex of Item of MessageDataColumns) and row number (vtIndex of Item of MessageDataLines).
I guess I don't understand the relationship between adding a "line" in my data display versus adding data into a "column". It appears that the "oLines.Add()" is used to bump across the columns of the data. If so, how do I advance to the next entire row of data in the message?
Thanks, DaveClass Item
Public ItemCode As String
Public Dscription As String
End Class
Dim ItemCodes as new list( of item)
Dim one as new item
one.ItemCode = "ItemCode"
one. Dscription ="Name of Item"
itemcodes.add (one)
Try
Dim oCmpSvc As SAPbobsCOM.CompanyService = _ocmp.GetCompanyService()
Dim oMsgSvc As SAPbobsCOM.MessagesService = oCmpSvc.GetBusinessService(ServiceTypes.MessagesService)
Dim oMsg As SAPbobsCOM.Message = oMsgSvc.GetDataInterface(MessagesServiceDataInterfaces.msdiMessage)
oMsg.Subject = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
oMsg.Text = Msg
Dim oMsgDataColumn As SAPbobsCOM.MessageDataColumn
If ItemCodes.Count > 0 Then
oMsgDataColumn = oMsg.MessageDataColumns.Add()
oMsgDataColumn.ColumnName = "Product / Item Code"
oMsgDataColumn.Link = BoYesNoEnum.tYES
For Each oneitem As Item In ItemCodes
Dim oMsgDataLine As SAPbobsCOM.MessageDataLine = oMsgDataColumn.MessageDataLines.Add()
oMsgDataLine.Object = "4"
oMsgDataLine.ObjectKey = oneitem.ItemCode
oMsgDataLine.Value = oneitem.Dscription
Next
oMsgDataColumn = oMsg.MessageDataColumns.Add()
oMsgDataColumn.ColumnName = "Description"
oMsgDataColumn.Link = BoYesNoEnum.tNO
For Each oneitem As Item In ItemCodes
Dim oMsgDataLine As SAPbobsCOM.MessageDataLine = oMsgDataColumn.MessageDataLines.Add()
oMsgDataLine.Value = oneitem.Dscription
Next
End If
Dim oMsgRecipient As SAPbobsCOM.Recipient = oMsg.RecipientCollection.Add()
oMsgRecipient.UserCode = "manager"
oMsgRecipient.SendInternal = BoYesNoEnum.tYES
oMsgRecipient.SendEmail = BoYesNoEnum.tNO
oMsgSvc.SendMessage(oMsg)
MsgBox("SAP B1 internal Message sent...")
Catch ex As Exception
MsgBox("Unable to send SAP B1 internal message. Error:" + ex.Message)
End Try
End Sub -
Place multiple columns (from a word doc) in a document?
Hello,
I am trying to place a word document with three columns of text in an indesign document. I tried changing the settings to "three columns" but that didn't help, the document shows up as one long column that of course runs off the bottom of the page.
What setting am I missing?
Cheers,
JamesPlacing heavily formatted Word docs is always an issue. InDesign treats the text as a continuous string.
>the document shows up as one long column that of course runs off the bottom of the page.
Could you explain this a little more? Are you saying that InDesign is creating a frame that runs off the page, or that you get a single column with only some of the text and a red plus sign in the out port?
I suspect the latter. There are a number of ways to place text, and options for how to do columns, too. If you've set up the document with three column guides you can flow continuous text into three frames inside the columns. Hold the shift key while you click the loaded place cursor to autoflow all of the text from column to column, adding pages until all of the text is on a page.
If you selected use master text frame when you set up the document, or put frames on the page before issuing the place command, you'll see the loaded cursor change from a square corner to parentheses when you are over the frame and the text will flow into that frame, filling from the top. If there is no existing frame, InDesign will create one on the fly that fits the guide width and runs to the bottom margin guide, but the top of the frame will be where you click. Subsequent frames when you use autoflow will start at the top margin.
As Scott said, you can also set a text frame to hold multiple columns, if you prefer. Both methods have advantages and disadvantages. Balancing columns is easier when they are in a single frame because you can adjust the frame size to affect all the columns at once.
Peter -
Multiple columns in a data file, but accounts not periods
Hi there,
A very quick question.
If I have a data file with, for example AcctDetail down the side and accounts across the top, am I right in thinking I can't load like this? Is it only periods that can be in multiple columns?
I'm trying to adapt an existing file, without changing it too much, but I think this might be beyond BPC!
Thanks,
JasonHi there,
The data I'm loading is actually Intercompany data for one unit, for one period.
So I have my affiliate (or counterparty, whatever term you use) down the rows, and the designated intercompany accounts across the top.
I don't need multiple columns for periods, as I'm only loading one period, but I would prefer to use multiple columns for Accounts dimension instead.
I know I can nest affiliates and accounts in the rows, but as I mentioned I would rather avoid changing the data file as much as possible.
Hope that make sense!
Thanks,
Jason
Maybe you are looking for
-
Payment processing is temporarily unavailable. Please try again later.
Payment processing is temporarily unavailable. Please try again later. whats hapen?
-
So as I said I bought it on a diffrent computer but with the same account, and when I sign in on my other computer with the account, it doesn't show up in the bought list, help?
-
Which modem should I buy?
Hi all, I use my apple TC for my home network and this is plugged into a pretty basic netgear modem. I've recently had an internet issue and have identified that the problem is the modem so i'm after some advice as to which modem I should buy to repl
-
User equivalence check failed for user "oragrid" in HP-UX
Dear Friends, while cluster verification utility i gotthe below error. $ ./runcluvfy.sh stage -pre crsinst -n aeadsverp11-adp.adp.ae,aeadsverp12-adp.adp.ae -fixup -verbose Performing pre-checks for cluster services setup Checking node reachability...
-
Outbox messages disappear and are not stored anywhere
0 When users are offline and send emails, they are kept in outbox, when they connect to the network the messages in outbox are sent. No problem here. the problem happens when, for some reason the outlook freezes when connected back to the network. th