Group output on date
Hi all,
I have a series of records stored in an Access table, each of them including a date/time. I am attempting to output my records grouping them on my date/time column, but because each time is unique, I get a separtate group for each record. Is it possible in my CF query to eliminate the time and just pull the date info? If so, how? For example, I want all records dated 3/15/2013 to be grouped, instead of 5 different records for 3/15/2013 grouped 5 different ways because of their varying times.
Thank you in advance!
When you run your query, add a string constant to the select clause.
select blah, blah, MyDateTimeField, 'update later' GroupField
from etc
order by MyDateTimeField
Then loop through your results and use querysetcell to set GroupField to DateFormat(MyDateField, 'mask of your choice').
Similar Messages
-
HOw Do I count and identify the number of groups in a groups output.
I have a query that reads like this..
SELECT s.spec_Sort,s.spec_ID, s.spec_Name, b.bus_Name,
b.bus_ID
FROM (tbl_businesses as b INNER JOIN tbl_SpecBusRel as sb ON
b.bus_ID = sb.specbus_busid) INNER JOIN tbl_specialties as s ON
sb.specbus_specid = s.spec_ID
ORDER BY s.spec_Sort, b.bus_Name
and then I am outputing like this...
<cfoutput query="rsGetSpecialties" group="spec_Name">
<cfif THIS IS WHAT I
NEED)></td><td></cfif>
<h2><a class="specialty" href="javascript;"
onclick="dwfaq_ToggleOMaticDisplay(this,'#spec_ID#');return
document.MM_returnValue">#spec_Name#</a></h2>
<div id="#spec_ID#" style="display:none">
<cfoutput><p><a
href="#request.details#?bus_ID=#bus_ID#">#bus_Name#</a></p></cfoutput>
</div>
</cfoutput>
This displays in this manner...
Specialty
dealer
Specialty
dealer1
dealer2
Etc...
What I am trying to do is find out how many specialties there
are, figure out where the middle is so I can insert a new table
data cell and start a new column.
Basically - two columns with the data divided in half by
specialty NOT by the number of dealers.
I hope that makes sense. Of course I am trying to do it w/ as
little query action as possible. My only solution may be to have
more than one query and the second only finds a list of the
sepcialties that contain the dealers and then find the middle one
and simply say if current specialty = middleSpecialty then start a
new column.
Thanks all,
ChrisThanks for the replies. I don't need the number of occurances
of each specialties - I simply need to know how many specialties
there are and then split them in half.
This may be the long way around -but it is what I did...
<cfquery name="rsGetSpecialties" >
SELECT s.spec_Sort,s.spec_ID, s.spec_Name, b.bus_Name,
b.bus_ID, b.bus_Pcity, b.bus_PState
FROM (tbl_businesses as b INNER JOIN tbl_SpecBusRel as sb ON
b.bus_ID = sb.specbus_busid) INNER JOIN tbl_specialties as s ON
sb.specbus_specid = s.spec_ID
ORDER BY s.spec_Sort, b.bus_Name
</cfquery>
<cfset specs = valuelist(rsGetSpecialties.spec_ID)>
<cfquery name="rsListSpecialties">
SELECT spec_ID,spec_Name
FROM tbl_specialties
WHERE spec_ID in(#specs#)
ORDER BY spec_Name
</cfquery>
<cfset middle = int(rsListSpecialties.recordcount/2)>
<cfset specs = valuelist(rsListSpecialties.spec_Name)>
<cfset middle = listgetat(#specs#,middle)>
then displayed like this...
<td valign="top" width="50%">
<cfoutput query="rsGetSpecialties" group="spec_Name">
<h2><a class="specialty" href="javascript;"
onclick="dwfaq_ToggleOMaticDisplay(this,'#spec_ID#');return
document.MM_returnValue">#spec_Name#</a></h2>
<div id="#spec_ID#" style="display:none">
<cfoutput><a
href="#request.details#?bus_ID=#bus_ID#">#bus_Name#
(#bus_PCity#, #bus_PState#)</a><br /></cfoutput>
</div>
*****This is the line that does the splitting *****
<cfif spec_Name EQ middle></td><td
valign="top" width="50%"></cfif>
</cfoutput>
</td>
As for removing the extraneous cfoutput --> I thought that
I needed that in order to show the material within the grouped
data. HOw does CF know what data to repeat and what data to not
repeat in a grouped output? I will have to look this one up some
more.
thanks for the help -
Report painter -output parameters,Data source,Extract parameter, report
Hi expert,
1)What report painter -output parameters,Data source,Extract parameter, report mean for and what are the difference?
2)I have create new report painter and transport to Test server using T-code:GCTR and I find that the T-code always point to old report. As I had check the SE93 the D_SREPOVARI-REPORT is point to report group.Why this happen?
3) Does creation of new report or modification of the report always need to select the extraction option so that it will able to display the relected changes? Because, I have done modification on the report but it is not reflected the changes even i save until i have to create the extraction is able to display the report but every time i run the report need to select the extraction with option to choose new extract or old. Kindly advice how to save and create the report painter and save will display reflected result .
Please helpHi BR Christian,
Thank you for the prompt reply.
I have few querys as below:
1)Do we every time create new report by copying the existing report painter need to select output parameter, data source and extract parameter in order to be able to display the new report?
2)when modify existing report painter and save it do we need to select output parameter, data source and extract parameter in order to be able to display the modify report correctly?
3) What are the different between right click copy the report inreport painter compare with create report painter with copy GRR1?
4) What are the T-code for modify the report group?
5) When I create a new report with the right click copy in GRR1 and modify the report painter column only and everything remain the same just the report name different why when execute the report it always appear in the selection screen with report button which have option button to select the 2 version of report which one is the destination report that I copy from and one is the new report? How to set the report when execute will only display the new report only without need to select the option with just new report only?
6)For transferring reports you can use GR37 (export) and GR38 (import) can be use to transport from one client to another client? What is difference between GR37 compare with GCTR?
7) If I use GR37 and GR38 it is mean no need to create the transport request which as usual we create transport se10?
we can directly import to another client ussing GR38?
8)When we create a new report with copy with the existing report with just modify the report colunm and the report name difference only what are the setting example: report,report group need to be selected to be include to export/transport to another client?
9) What are the difference between library and report group?
10) Can we set Se93 to execute only report not report group? How?
11) when using GR37 to transport it is also include the report group,library and the particular report?
12) Can I include the variable in the column header to display fiscal year which I have selected from the selection screen?
How and which variable should i use?
please help.
many thanks
Edited by: KH on Jun 18, 2011 6:52 AM
Edited by: KH on Jun 18, 2011 6:55 AM
Edited by: KH on Jun 18, 2011 7:06 AM -
Payment Medium Workbench - Group by Posting Date
I have made a medium format with DMEE Engine but it doesn't work as I would like.
I want to have a file with all items group by posting date (subtotals group by posting date, no depends on vendor).
I have 2 leveles:
- Level 1: Repetition Factor 1 and Key Field FPAYP-FAEDT (Posting Date)
- Level 2: Repetition Factor 999999 and Key Field FPAYP-DOC2R (Document unique key)
However when I execute F110 transaction it generates different files, WHY?
One file per vendor and posting date, but I WANT TO HAVE A UNIQUE FILE.
Example
Vendor Posting Date Ammount
ITEM 1: xx 15/10/2007 100
ITEM 2: xx 15/10/2007 200
ITEM 3: yy 15/10/2007 300
ITEM 4: xx 21/10/2007 400
ITEM 5: zz 21/10/2007 500
Output (wrong)
FILE1:
15/10/2007
xx 100
xx 200
300
FILE2:
15/10/2007
yy 300
300
FILE3:
21/10/2007
xx 400
400
FILE4:
21/10/2007
zz 500
500
Output (ok)
FILE1:
15/10/2007
xx 100
xx 200
yy 300
600
21/10/2007
xx 400
zz 500
900
Thanks in advanced!Ok, the problem has been fixed.
The repetition factor for level 1 (Posting Date) should be 9999999 instead of 1, beacuse it refers to input data and it doesn't refer to output data.
We can have differents posting dates in input data, but we want to have a unique line by posting date in output data.
Regards! -
Grouping with 2 date in sql server
totle_count
dt
name
program_id
1
1/3/2015
Tea
14
1
1/5/2015
Tea
14
1
1/6/2015
Lunch
13
17
1/6/2015
Tea
14
2
1/9/2015
Breakfast
1008
39
1/10/2015
Breakfast
1008
4
1/19/2015
Breakfast
1008
1
1/19/2015
Dinner
1009
3
1/21/2015
Tea
14
totle_count
dt
name
program_id
1
1/6/2015 and 1/8/2015
Lunch
13
2
1/3/2015 and 1/5/2015
Tea
14
17
1/6/2015 and 1/9/2015
Tea
14
3
1/21/2015 and 1/23/2015
Tea
14
41
1/9/2015 and 1/11/2015
Breakfast
1008
4
1/18/2015 and 1/20/2015
Breakfast
1008
1
1/18/2015 and1/20/2015
Dinner
1009
Here is 2 table, 1st is my row table, and I want to group with 2 date.
Here is 3 days difference. and sum of value is coming.
2nt table is my expectation table.
Plz help me for this problem.
Thanks
SamirI am doing 3 days grouping here
"dt" is name of date column
if "dt" column has '1/19/2015' then next in group it will come in "1/18/2015 and1/20/2015"
any date of 18 or 19 0r 20 it will come in "1/18/2015 and1/20/2015"
and counting will add between 3 date
Sorry your posted output is not as per above rule
How did row for 1/6/2015 and 1/9/2015 got included then. If you group by 3 days you wont get
this row as 6-9 is 4 days not 3 days
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Alt row color in grouped output
I've always used the following code to alternate row colors
in a table of CFOUTPUT:
<tr bgcolor="#IIf(query.currentRow Mod 2, DE('cfcfcf'),
DE('eeeeee'))#">
However, when I use this code in a table with grouped output,
I get unpredictable row colors. For example, the first two rows
will be color1, the next two color2, then the next few rows will
alternate like I want.
I'm attaching the code I'm currently working on.
Any ideas how to get the alt row colors to display properly?
Thanks in advance...Sorry, my initial search to find the answer came up nill.
When I searched again I found the answer which I'm pasting below.
It worked great.
===========================================================================
when you use the GROUP attribute of CFOUTPUT, your data is no
longer being output in the same order in which it was retrieved.
the CURRENTROW variable is no longer in chronological order (you're
displaying the first grouped element, then 1-n members of that
group, then repeating).
you'd need to set an iterating variable.
<cfset myRowCountVar = 0 />
<cfoutput query="q_remnts_f3" group="req_Cat">
<cfset myRowCountVar = myRowCountVar + 1 />
(now use 'myRowCountVar' to key off of to determine the
background color rather than currentrow)
charlie griefer (CJ)
http://charlie.griefer.com
@ #coldfusion / DALnet
================================================================================= -
Post Author: tadj188#
CA Forum: Formula
Needed: Sum of LineCount Including Groups and Detail Data On Each Page Used To Generate New Page If TotalPageLineCount > 28
Background:
1) Report SQL is created with unions to have detail lines continue on a page, until it reaches page footer or report footer, rather than using subreports. A subreport report is now essentially a group1a, group1b, etc. (containing column headers and other data within the the report with their respective detail lines). I had multiple subreports and each subreport became one union.
Created and tested, already:
1) I have calculated @TotalLineForEachOfTheSameGroup, now I need to sum of the individual same group totals to get the total line count on a page.
Issue:
1) I need this to create break on a certain line before, it dribbles in to a pre-printed area.
Other Ideas Appreciated:
1) Groups/detail lines break inconveniently(dribble) into the pre-printed area, looking for alternatives for above situation.
Thank you.
Tadjexport all image of each page try like this
var myDoc = app.activeDocument;
var myFolder = myDoc.filePath;
var myImage = myDoc.allGraphics;
for (var i=0; myImage.length>i; i++){
app.select(myImage[i]);
var MyImageNmae = myImage[i].itemLink.name;
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high;
app.jpegExportPreferences.exportResolution = 300;
app.selection[0].exportFile(ExportFormat.JPG, File(myFolder+"/"+MyImageNmae+".JPEG"), false);
alert(myImage[i].itemLink.name) -
Oracle Reports with XML output showing data as asterik character
Hello,
I'm trying to create an Oracle report with xml output. Here is the issue I'm having some of the columns in my report are of datatype number. When I run the report and generate xml file the values for those columns(datatype number) are showing as (*) character, other columns are showing fine. But when I run the report as text output then data is fine. I don't understand why this is happening.
The property of column is Column Type - Database Scalar, Datatype - Number , width 0,-127.
Does the width has to do anything with this?
I'm using Report Builder 6.0.8.11.3, DB version 10g.
Can anyone please help me with the issue I'm having.
ThanksIf the links in your example report1 and report2
follow my format stated earlier
http://machine:port/reports/rwservlet/report=reportnam
e.rdf&destype=cache& paramform=htmlcss&server=<YourReportSe
rverName>&userid=scott/tiger@hrdb&desformat=pdf
This is what I believe
>
so http://machine:port/ is the port where
JBoss is running and
This should be the port that the report server is listening on
>
server=<YourReportServerName> is the name of
my oracle report server
so I call the above link in my current application
and the report would show up
Yes
>
that means (correct me if I am wrong) that my reports
would have to be deployed in OracleAS
Yes
>
I have to try all this yet as till this point I was
trying to run Oracle reports deployed in JBoss...
This may be possible, I am not sure.
>
Oracle J2EE Thin Client?
I am not sure what this is used for in your setup. -
Count(*) with group by max(date)
SQL> select xdesc,xcust,xdate from coba1 order by xdesc,xcust,xdate;
XDESC XCUST XDATE
RUB-A 11026 01-JAN-06
RUB-A 11026 05-JAN-06
RUB-A 11026 08-JAN-06
RUB-A 11027 10-JAN-06
RUB-B 11026 02-JAN-06
RUB-B 11026 08-JAN-06
RUB-B 11026 09-JAN-06
RUB-C 11027 08-JAN-06
I want to make sql that result :
XDESC COUNT(*)
RUB-A 2
RUB-B 1
RUB-C 1
Criteria : GROUPING: XDESC XCUST AND MAX(DATE)
bellow mark *** that was selected in count.
XDESC XCUST XDATE
RUB-A 11026 01-JAN-06
RUB-A 11026 05-JAN-06
RUB-A 11026 08-JAN-06 ***
RUB-A 11027 10-JAN-06 ***
---------------------------------------------------------COUNT RUB-A = 2
RUB-B 11026 02-JAN-06
RUB-B 11026 08-JAN-06
RUB-B 11026 09-JAN-06 ***
---------------------------------------------------------COUNT RUB-B = 1
RUB-C 11027 08-JAN-06 ***
--------------------------------------------------------COUNT RUB-C = 1
Can Anybody help ?
I tried :
select xdesc,max(xdate),count(max(xdate)) from coba1 group by xdesc
ERROR at line 1:
ORA-00937: not a single-group group function
ThankThis one is duplicate. see the following link
Count(*) with group by max(date)
Thanks -
Group by with date range.
Hi,
I am looking for effective usage of Group by against date range.
I have a transaction table as below.
Date customer_no amount_paid
01-Dec-13 001 500
02-Dec-13 001 360
09-Dec-13 001 200
02-Nov-13 001 360
09-Nov-13 001 200
02-Nov-13 001 360
09-Oct-13 001 200
02-Oct-13 001 360
09-Oct-13 001 200
02-Sep-13 001 360
09-Sep-13 001 200
............... etc.
I would like to see sum(amount_paid) by past date ranges 1-30 days, 31-60 days, 61-90 days.
Below are expected results.
Customer Duration amount_paid
001 1-30 980
001 31-60 450
001 61-90 1200
002 1-30 300
002 31-60 490
002 61-90 320
003 1-30 450
......................etc.
I have to group by customer no and date range (1-30, 31-60, 61-90..etc).
Can someone help me getting query for this.
Thanks...
Sreeram.SQL> with t
2 as
3 (
4 select to_date('01-Dec-13', 'dd-Mon-rr') dt, '001' customer_no, 500 amount_paid from dual
5 union all
6 select to_date('02-Dec-13', 'dd-Mon-rr') dt, '001' customer_no, 360 amount_paid from dual
7 union all
8 select to_date('09-Dec-13', 'dd-Mon-rr') dt, '001' customer_no, 200 amount_paid from dual
9 union all
10 select to_date('02-Nov-13', 'dd-Mon-rr') dt, '001' customer_no, 360 amount_paid from dual
11 union all
12 select to_date('09-Nov-13', 'dd-Mon-rr') dt, '001' customer_no, 200 amount_paid from dual
13 union all
14 select to_date('02-Nov-13', 'dd-Mon-rr') dt, '001' customer_no, 360 amount_paid from dual
15 union all
16 select to_date('09-Oct-13', 'dd-Mon-rr') dt, '001' customer_no, 200 amount_paid from dual
17 union all
18 select to_date('02-Oct-13', 'dd-Mon-rr') dt, '001' customer_no, 360 amount_paid from dual
19 union all
20 select to_date('09-Oct-13', 'dd-Mon-rr') dt, '001' customer_no, 200 amount_paid from dual
21 union all
22 select to_date('02-Sep-13', 'dd-Mon-rr') dt, '001' customer_no, 360 amount_paid from dual
23 union all
24 select to_date('09-Sep-13', 'dd-Mon-rr') dt, '001' customer_no, 200 amount_paid from dual
25 )
26 select customer_no
27 , ((grp_val - 1) * 30) + 1 start_val
28 , grp_val * 30 end_val
29 , sum(amount_paid) amount_paid
30 from (
31 select dt
32 , customer_no
33 , amount_paid
34 , ceil(sum(dt_interval) over(partition by customer_no order by dt)/30) grp_val
35 from (
36 select dt
37 , customer_no
38 , amount_paid
39 , nvl(dt - lag(dt) over(partition by customer_no order by dt), 1) dt_interval
40 from t
41 )
42 )
43 group
44 by customer_no
45 , grp_val
46 order
47 by grp_val;
CUS START_VAL END_VAL AMOUNT_PAID
001 1 30 560
001 31 60 760
001 61 90 920
001 91 120 1060
SQL> -
Outputting a data point every second
I want to output a data point every second to an excel sheet. I got it so that it only outputs one accumlated data point. Each data point includes a timestamp, rate, and volume.
Attached is my VI.
Solved!
Go to Solution.
Attachments:
PumpDriver Test 4.vi 82 KBMike227 wrote:
Hey Ravens,
It never worked...the status isn't even updating which leads me to think that I am getting an error and not clearing it?
If you post the code, we might be able to help you figure it out. And errors happen for a reason. Are you actually getting an error? If so, what is the error?
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Accessing the output type data in rv60afzz exit
Hi All,
I want to access the output type data in stored in VNAST table of the program SAPLV61B from the user exit. I am doing this using field symbol. But I am not able to get it .
data :it_xnast like vnast OCCURS 20 WITH HEADER LINE,
it_x1nast like vnast OCCURS 20 WITH HEADER LINE.
field-symbols :
<Fs1> type ZSDTT_VNAST,<Fs2> type ZSDTT_VNAST .
data: wa_xnast type vnast, wa_x1nast type vnast.
assign ('(SAPLV61B)XNAST[]') TO <fs2>.
assign ('(SAPLV61B)VNAST[]') TO <fs1>.
I have written the same code for the order user exit. There the field symbol is getting assigned with the internal table. But in case of this user exit, the sy-subrc is coming 4.
Or is there any other user exit, I can make use of this for such requirement?
Thanks in advance,
Rgds.
Madhuri
Edited by: madhuri sonawane on Nov 30, 2009 4:32 PMHi Nishant,
I think you have not understood my problem. I want to access the internal table where the output types data gets stored at run time for the particular invoice. The code I have written is working fine in the order's user exit. That means I can access the data in order. But in the case of billing , even if that program SAPLV61B is getting called before the execution of this user exit, no data is coming in the field symbol FS1 neither and not even in FS2. I want to know is there any other user exit, where I can access the run time data of the output types attached to that invoice. or is there any other program from where I can access the output type data in the same above user exit.
Rgds,
Madhuri -
Hi to all,
I want grouped output based on input group.
e.g
SQL> select * from test_data;
FIELD
a
b
c
d
e
a
e
c
d
e
10 rows selected.
SQL>
Now I want grouped output like this
When I give input set (a,b) then output should be :
a,b
a
c
c
d
d
e
e
e
When I give input set (a,e) then output should be :
a,e
a,e
b
c
c
d
d
e
I want a query regarding this , I know this is possible through Pl/SQL, but the requirement is through query.....
rgds,
RupI want grouped output based on input group.
I want a query regarding this
with
test_data as
( select substr(p, instr(p, ',', 1, level) + 1, instr(p, ',', 2, level) - instr(p, ',', 1, level) - 1) as field
from (select ',' || 'a,b,c,d,e,a,e,c,d,e' || ',' as p from dual)
connect by level <= length(p) - length(replace(p, ',')) - 1
input_set as
( select distinct substr(p, instr(p, ',', 1, level) + 1, instr(p, ',', 2, level) - instr(p, ',', 1, level) - 1) as field
from (select ',' || 'a,d,e' || ',' as p from dual)
connect by level <= length(p) - length(replace(p, ',')) - 1
group_count as
( select min(count(i.field)) as group_cnt
from test_data t, input_set i
where i.field(+) = t.field
group by t.field
having count(i.field) > 0
test_data2 as
( select field,
row_number() over (partition by field order by null) as group_no1,
row_number() over ( order by null) as group_no2
from test_data
input_set2 as
( select field, row_number() over (order by field) as item_no
from input_set
select max(fields) as fields
from
( select
replace(sys_connect_by_path(decode(level, 1, group_no2), '-'), '-') as group_no,
ltrim(sys_connect_by_path(t.field, ','), ',') as fields,
level as lvl
from test_data2 t, input_set2 i, group_count
where i.field(+) = t.field
start with group_no1 > group_cnt or item_no = 1 or item_no is null
connect by prior group_no1 <= group_cnt and group_no1 = prior group_no1 and item_no = prior item_no + 1
group by group_no
order by max(lvl) desc, fields
FIELDS
a,d,e
a,d,e
b
c
c
e
6 rows selected. -
EDI Shipment Output Master Data Conversion
Hi,
I am using LSMW to upload EDI Shipment Output Master Data into file can anyone suggest me any standard BAPI or Idoc avail for the same or any function module available to do this.
Thanks
Dhirendrawe have below LSMW IDOC methods
OILSHL TD Shipment to TAS
RECSHP Recommended shipments
SHIPMENT_CREATEFROMDATA Create shipment
SHIPPL Inbound planned shipments
SHPMNT_TNDR Shipment tendering
TPSSHT Shipping planning system: Transfer planned shi -
Using Authorization group field in Data entry profile
Hi,
I would need some help in configuring/using the authorization group field in data entry profile.
After setting up the values in the drop down, how do we link to the authorization profiles or roles .
basically, I would like to know the steps/activities required to use this fieldcross posting->thread locked.
Maybe you are looking for
-
Time-dependent BW hierarchies in Analysis for OLAP
Hi all, We are using time-dependent hierarchies in combination with a key date variable. Tools used: Query designer based on SAP BW 7.4 and BO 4.0. The following steps are executed: Report is executed and key date is prompted According to the key dat
-
Please encode the password for me
what is the password please help
-
Default Selection in Combo Box
Hi, I have a query regarding combo box. I have populated combo box using UserDataSources. Is it possible to make a default selection of an Item in combo box. Regards Ronald
-
Combine checked item and update column
Hi all, need to design a screen that allow user to update column (code) and also pick which statement to display for the next stage. My thought was to create a checkitem and LOV display. Once user has checked the box , the process should update the c
-
Have been encoding ac3 without any problems until recently. Now all ac3 encodes just play back as digital "noise", and the problems exists with default as well as modified versions of the standard ac3 preset. I'm using latest versions of Compressor a