Grouping of type Date
hi i am stuck on a problem. i have an ArrayList collection of messages which returns 4 fields i.e.
1. a date of when the msg was sent (YYYY-MM-DD)
2. int index of a (0-100)
3. int index of b (0-100)
4. int index of c (0-100)
this collection returns several of these messages and have related dates.
so for example several emails were sent out on a particular date - 20/11/2001
i want to group/count how many emails were send out on this day and the same for the rest of the dates.
and also calculate averages of index a, b and c for the that day and move on to another date in the array
pls can anyone help thanks.
moh
You seem to be saying "returns" when you really mean "contains".
Anyway, this doesn't sound very hard. You can do it in a variety of ways. Probably the easiest thing is to create a Map<Date, List<Message>> where the date key is the key in the message objects. Or if the dates are all at different times of day and you just want to arrange the messages by day of the year, you could create new date keys with the time of day all set to noon or something. Then just loop through the Map.Entry objects for that Map, and do your calculations for each day.
Similar Messages
-
Select max date from a group of columns of type date
hi ,
my requirement is i have 5 columns
ID, date1,date2,date3,date4.
first column is integer type and is primary key and remaining all columns are type DATE
the values in the table are for example:
ID date1 date2 date3 date4
100 8/19/2007 4:29:44 PM 8/18/2007 3:50:34 PM 8/16/2007 3:20:55 PM 8/20/2007 5:19:24 PM
101 8/21/2007 5:29:44 PM 8/19/2007 4:20:34 PM 8/19/2007 4:29:44 PM 8/18/2007 2:50:45 PM
the output required is
ID closeddate
100 8/20/2007 5:19:24 PM
101 8/21/2007 5:29:44 PM
i want the max of all dates in all date columns in one single column for each row
the query which i tried is
select ID,max(closed_date)
from t1,TABLE(Date(date1,date2,date3,date4)) closeddate
but its not working
can any body help me out in solving this
thanks in advanceso use the NVL on each column. and set it to
something ridiculous, so it will always be less than
the other values. and then, if the ridiculous value
shows up, it means all the columns were null for that
row.Rather than relying on some rediculously small date use coalecse on each date column with the date column of intereste listed first. The order of the remaining terms in the coalesce statement is unimportant. e.g. on a table with three date columsn:
with x as (
select 1 id, sysdate dte1, sysdate-1 dte2, sysdate+1 dte3 from dual union
select 2, sysdate, null, null from dual union
select 3, null, sysdate-1, null from dual union
select 4, null, sysdate-1, sysdate+1 from dual union
select 5, null, null, null from dual
select id,
greatest( coalesce(dte1,dte2,dte3),
coalesce(dte2,dte3,dte1),
coalesce(dte3,dte1,dte2)) Max_Date
from x
ID MAX_DATE
1 09-OCT-2007 12.15.44
2 08-OCT-2007 12.15.44
3 07-OCT-2007 12.15.44
4 09-OCT-2007 12.15.44
5 (null)
5 rows selecteThis way if they are all null, you get a null result, and don't need to handle your null value date as a special case. It also avoids the situation where the unlikely event occurs where your special null value date appears as actual data. -
Find Sum of grouped events by date
I'm using Report Builder 10.50.2500.0
I've been trying to do this for awhile and have run out of ideas to try. I think it's a simple solution but I can't figure it out.
I have a database that is used for events. A booking can have several different events associated with it, even on the same day at different times. The events can be classified as breakfast, lunch or dinner events.
The report is grouped by type of event, then by event date (not datetime, the overall date), then grouped by booking.
Basically, I need the sum the total attendance of each breakfast, lunch, and dinner event by date and by booking.
For breakfast events I have this code on the Event Classification group row:
=iif(Fields!EventClassification.Value = "Breakfast",SUM(Fields!CurrentAttendance.Value),0) and the same for lunch and dinner. This works except when when there is more than one event per day.
For example, on 6/11/13 there is one lunch event and one dinner event. The report shows
Date
EventName
Breakfast
Lunch
Dinner
6/11/13
EventName
0
50
0
6/11/13
EventName
0
0
50
When what I want is:
Date
EventName
Breakfast
Lunch
Dinner
6/11/13
EventName
0
50
50
Any ideas? I've tried using group variables and passing to a report variable and acting on that but that didn't work out properly.Hi Jmelinda,
In order to achieve your requirement, we can refer to the following steps:
In the Row Groups pane, right-click the Details group to add a parent group grouped by Date field.
Right-click the Date group to add a parent group grouped by Date field.
Right-click the Date group to add a total row after the group.
Delete the second and third columns with “Delete columns only” option for Date field.
Type the expression below to the total row for Breakfast column, and the same for lunch and dinner:
=sum(iif(Fields!EventClassification.Value = "Breakfast", Fields!CurrentAttendance.Value, 0))
Set the visibility of second row to Hide.
The following screenshot is for your reference:
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Marketingattributes from type "Date" in CRM 7.0
Hello Experts,
we think about two new marketing attributes for contact persons:
1. Invitation send
2. Answer received
Both attributes are from type date.
The question is how can i search for all contact persons having for example attribute invitation send with value between 01.01.2010 and 30.11.2010. The popup searchhelp for marketing attributes does not allow intervalls.
Any ideas for this?
Thank you
Kind regards
ManfredHi Manfred,
You can do it in 2 ways.
1) Have BW pull in Marketing Attributes. Create a BW report and search for BP having the dates in the range you want
2) USe Segment builder and create a target group .
Hemanth -
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) -
Error while setting a value into an UDF of type date
Hello,
i get the following error while trying to set a value to an udf with the type "date":
Exception from Server: RPC_E_SERVERFAULT
This code is used:
objDate = CDate(objLineRecordSet.Fields.Item("U_TESTDATE").Value)
objDocument.Lines.UserFields.Fields.Item("U_ACTDATE").Value = objDate '### Here comes the error
The application is in PL 29Christian,
If you search this forum on "date UDF" you will find many posts that may assist you such as this one ...
Format of string passed to Date/Time Hour UDF
HTH,
Eddy -
If a class method exporting a value with the generic type 'data'.
Then how can I get the information?
For exmple.
cl_my_clss->get_value( exporting ev_data = .... ) .
ev_data is a type of data.
I can not use DATA : lv_mine type data. because generic data should be used in formal parameter, however , if I use a field symbol, how to assign value with out knowing the data type?
Best regards,Hi Blake,
As per my understanding,
You are getting the data type from the database table....
You want to use the same data type....
Lets say for example:
You have a db table x with field y having data type Z.
What you do is that, while declaring the data type for the attribute in the method use the reference as table_name-field_name(x-y).
Or....
use ANY. This will give you a chance to map any field type to this method....
Note: Using ANY will limit the syntax that you can use within the method......
Regards,
Kunjal -
Handle null value in char infoobject -data type DATE(ora-01722 invalid num)
Hi,
We have a DSO with a info object in the Data fields. The char info object has the data type DATE and most often it has the null value. but some times it has data in it.
When ever we were trying to run a report on the DSO it throws a error as ORA- 01722 INVALID NUMBER.
we tried editing PSA data and placing 00000000 for null values - and had a message invalid date.
suggestions pls
Regards.Hello,
Please check the note given below
https://service.sap.com/sap/support/notes/1327167.
If null value is the problem, change the query setting for not to show the null values. Just add a filter in ZDAT to exclude "NULL"
Thanks
Nidhi -
Bursting 2 Oracle BI Analysis type Data Set
Hi
We have 2 Oracle BI Analysis type Data Set.We are able to burst but in the email we just recieve only email attachement with only header(only column headings) ( in
excel/pdf output without any data.
But when we import the report xml and load into xml into template we are able to preview data in excel or PDF format.
Could you Please answer as soon as possible
Thanks
Niteshedit BI Analysis and remove any FILTER USING etc... save analysis and then try in BIP to add the BI Analysis data set.
-
How can I use a variable in BEx of type date ?
Hello,
I have an infoprovider with a key figure of type "date" and I want to display for example all the data where the date is lower than a date entered by the user.
So I want to create for that a date variable and use it in conditions.
When I try with "manual entry", I can't get the type "date" : it proposes quantity, amount, number but not date.
When I try with "customer exit", I can get the type "date" but when I get it on the selection screen, the date is seen as a number so it doesn't work.
Does anybody have an idea.
Thanks for your help.
Regards,
Vanessa RoulierHi!
if you are using a cube then there will be at least one time char. I think you can just add 0calday to your cube , even if you are not filling it.
Once this is available in cube it can be used in query (free chars) where we can define a variable on this 0calday. But we it will not have any effect on query results as you are not storing anything in your query.
then in your conditions you create a variable with USEREXIT type. then in your ABAP code you can access the value stored in variable(which is entered by user) and copy it to the USEREXIT variable. Then your condition works because it is having a date type and the value is date.
I don't see any problem in implementing this scenario.
with regards
ashwin -
Conversion from string "20041023 " to type 'Date' is not valid.
Hi ,
I have a table with one of the column(EmpHiredate) datatype is char(10). It has value like "20141023". I need to display this value as date format(dd/mm/yyyy) in report.
Following methods i tried in textbox expression but no luck.
=Format(Fields!EmpHireDate.Value,"dd/MM/yyyy")
=Cdate(Fields!EmpHireDate.Value)
Error:
[rsRuntimeErrorInExpression] The Value expression for the textrun ‘EmpHireDate.Paragraphs[0].TextRuns[0]’ contains an error: Conversion from string "20041023 " to type 'Date' is not valid.
Is it possible to convert string to date using SSRS textbox expression ? Can anyone help me with the solution.
Thanks,
KittuHi Jmcmullen,
Found one more issue on the same. I have one value like "00000000" for the column(EmpHiredate)
, when i use above expression values(ex:"20141023")
are displaying in dd/MM/yyyy format in report except value like "00000000" and giving following error:
[rsRuntimeErrorInExpression] The Value expression for the textrun ‘EmpHireDate.Paragraphs[0].TextRuns[0]’ contains an error: Conversion from string "0000/00/00" to type 'Date' is not valid.
Even i tried to pass its original value("00000000") as below but no luck.
=IIF(Fields!EmpHireDate.Value = "00000000","00000000",Format(CDATE(MID(Fields!EmpHireDate.Value,1,4) + "/" + MID(Fields!EmpHireDate.Value,5,2) + "/" + MID(Fields!EmpHireDate.Value,7,2)),"dd/MM/yyyy"))
Also tried this:
=IIF(Fields!EmpHireDate.Value = "00000000","2000/10/21",Format(CDATE(MID(Fields!EmpHireDate.Value,1,4) + "/" + MID(Fields!EmpHireDate.Value,5,2) + "/" + MID(Fields!EmpHireDate.Value,7,2)),"dd/MM/yyyy"))
Please Suggest.
Thanks ,
Kittu -
MDM JAVA API to enter value into field of type date
Hi All,
I am having an input field in a typical Dynpro application where a date would be entered.I want to enter the date in my MDM table in a field of type "Date".Do you have any idea about MDM JAVA API's I need to do this.Also how can I do this ?
Thanks
VinayHi,
Web Dynpro shall return you a type Date field. For Value, you shall have to pass SystemTime Object.
Just get the substring of Date.toString() and convert them to Integer ..
So a typical date would look like yyyy-mm-dd (eg: 2006-10-19) and not yyyymmdd.
SystemTime st = new SystemTime();
st.setYear( Integer.parseInt(Date.toString().substring(0,4));
st.setMonth ( Integer.parseInt(Date.toString().substring(5,7));
st.setDate ( Integer.parseInt(Date.toString().substring(8,10));
A2iField date = new A2iField("fieldname", new Value(st));
Hope that helps..
Regards,
Tanveer.
<b>Please mark helpful answers</b>
Note: The above mentioned code is not pasted from any editor..So might contain syntax error.. -
Insert a value of type Date/Time into a database
I am trying to insert a value of type date time into an access database. What is the format needed to insert the date/time.
Thanks,
-AmosI had all kinds of problems getting a datetime inserted into a SQl Server DB. Probably similar so this is what I do:
String date = new String("01/01/97 12:00:00");
stmt.setObject(1, date);
I tried using TimeStamp's but found I got an occasional Fractional Truncation exception back from the driver. Never had a problem inserting a String using the setObject() method though.
Hope this helps -
Issue with Data type 'Date' in Hyperion Planning V11.1.2.2
Hi,
I have created members with data type date. However when I save the date, it either disappears or comes up with a random date? Has any one come across this kind of problem before?
If so can you share the fix.
Thanks in advance for your help.
Cheers,
XXXHi
This problem is linked to you not having a consistent setting for your date input type.
So, go to application administration and set the date format to MM/DD/YYYY in application settings and display options, under current application defaults. Then after you have done this as a user go to User Preferences and display options and on the date format select the same. Or remove the Automatically detect.
I have seen this behaviour if you have Automatically Detect on the user preferences
Thanks
Anthony -
Hi All,
following piece of code was working fine in 4.6 C but in ECC 6.0 I get the following error:
" "END_OF_RECORD" must be a character-type data object (data type C, N,D, T or STRING) . "
I tried type-casting with field symbols but still not able to remove the error. Cannot convert end_of_record directly to type C as it may hamper the functionality. Plz advice how to remove the error without converting type x to type C
In the following code :
DATA: DELIMITER TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
end_of_record TYPE x.
SPLIT data_file_i AT delimiter INTO it_ekko-rtype
it_ekko-ebeln
it_ekko-bsart
it_ekko-lifnr
it_ekko-bedat
it_ekko-ekorg
it_ekko-ekgrp
it_ekko-bukrs
it_ekko-zterm
it_ekko-zbd1t
it_ekko-zbd1p
it_ekko-zbd2t
it_ekko-zbd2p
it_ekko-zbd3t
it_ekko-inco1
it_ekko-inco2
it_ekko-waers
it_ekko-wkurs
it_ekko-kufix
it_ekko-verkf
it_ekko-telf1
it_ekko-ihrez
it_ekko-unsez
it_ekko-angnr
it_ekko-ihran
it_ekko-submi
it_ekko-loekz
end_of_record.
where all these fields except " end_of_record " are of character type and "data_file_i " is a character type structure as defined below:
DATA :
BEGIN OF data_file_i OCCURS 0,
record(1000),
END OF data_file_i,Type X is not allowed in Unicode. When a field is declared as Type X with Value u201809u2019 or any other value, it can be resolved by using classes.
Before Unicode
CONSTANTS: c_hex TYPE x VALUE '09'.
Resolution:
Itu2019s work for any value of x.
First a temporary field of Type c should declare. Following class will convert Type x variable into type c.
Example:
CONSTANTS: c_hex TYPE x VALUE '09'.
DATA: LV_TEMP TYPE STRING.
DATA: LV_TMP TYPE C.
TRY.
CALL METHOD CL_ABAP_CONV_IN_CE=>UCCP
EXPORTING
UCCP = c_hex
RECEIVING
CHAR = LV_TMP .
CATCH CX_SY_CONVERSION_CODEPAGE.
CATCH CX_PARAMETER_INVALID_TYPE.
CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
ENDTRY.
CONCATENATE I_OUTPUT-BKTXT I_OUTPUT-BVORG
I_OUTPUT-BUDAT I_OUTPUT-MESSAGE INTO
SEPARATED BY LV_TMP.
I_BUFFER = LV_TEMP.
CLEAR LV_TEMP.
CLEAR LV_TMP.
OR
Note: It works only for type x value 09.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS: c_hex TYPE c VALUE
abap_char_utilities=>HORIZONTAL_TAB.
Maybe you are looking for
-
Satellite P300: BSOD error STOP: c0000139 {entry point not found}
I've been having this error for a few weeks on my Toshiba P300. When I start my notebook there appears a blue screen with an error for a split of a second: STOP: c0000139 {entry point not found} The procedure entry point ntoskrnl.ExiAcquireFastMutex
-
PR release/reject programmatically
Hi I have a requirement in Blackberry PR Approval process. A Corporation currently has SAP Workflow and they are currently using it to send PR items via Outlook to the approver of these PRs. The approver then gets an email which contains a link to th
-
How can I download the Australian Open Tennis printable DRAWS?
How can I download the Australian Open Tennis printable DRAWS?
-
kindly resolve my issue i assigned inspection type 10 in material master. i configured origin 10 inspection at shipping every truck i want to create delivery order and create shipping document this shipping document link with contract and sa
-
Hey all, Just noticed in my iStat widget that Fan 1 of my macbook pro is at 0 rpm. The hardware test gave me the following error code: 4MOT/1/40000002 left-middle-top. Would anyone please tell me what this means? And perhaps a way to fix it? Many tha