Home
Analytics
Entire Timestamp into integer
235383
Hi ,
Is there any function in Actuate to split the hours, minutes and seconds of Timestamp and make as integer.As like we do Datepart function to split m,d,YYYY.
If we have something like that we can split month , date, year,hours,min and seconds as integer and add them all to store as single integer value.
Nothing but to make a timestamp into single integer value.
For example,
Timestamp: 2011-08-08 06:05:11
adding 2011+08+08+06+05+11=2049.
We can group it together after converting it into like this.
I face the following issue:
ID-CHAR-Timestamp
123-A
2011-08-08 06:05:11.111
123-B
2011-08-08 06:05:11.123
123-C
2011-08-08 08:05:11.222
123-D
2011-08-08 08:05:11.222
124-A
2011-08-08 15:05:11.333
124-B
2011-08-08 15:05:11.333
125-A
2011-08-08 09:05:11.444
125-B
2011-08-08 09:05:11.444
126-A
2011-08-08 04:05:11.555
126-B
2011-08-08 04:05:11.555
If we groupby CHAR we get
123
A,B,C,D
124
A,B
125
A,B
126
A,B
my requirement is to splitt the group 123 again into two different groups as below
123
A,B
123
C,D
i dont have any other column apart from the timestamp.
please suggest me how to implement this......
Thanks
prasad.
Find more posts tagged with
Comments
mwilliams
If you have the timestamp as a field, you can create a computed column in your dataSet that has an expression like row["myField"].getYear() + row["myField"].getMonth() + row["myField"].getDate() + row["myField"].getHours() + row["myField"].getMinutes() + row["myField"].getSeconds(). This would add all of these values together, but I don't know if this would do what you're wanting because month is not weighted higher than date, so 2-1-2011 would actually be less than 1-31-2011 and 2-1-2011 and 1-2-2011 would be the same. Maybe I'm not understanding completely.
mcremer
If its a time stamp object. (E.g. a DATETIME object you queried from a database)<br />
<br />
Then you can do a lot of formatting trough the Formating trough the options of a dataobject.<br />
<br />
Here you can use the Format DateTime in varius ways.<br />
<br />
<br />
Furher more you could always use Java together with the java script resulting in things like:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
nl_NL = new Packages.java.util.Locale("nl","NL");
dfd = new Packages.java.text.SimpleDateFormat("dd-MM-yyyy");
dfy = new Packages.java.text.SimpleDateFormat("yyyy");
dfw = new Packages.java.text.SimpleDateFormat("ww",nl_NL);
dfm = new Packages.java.text.SimpleDateFormat("MM");
switch(dataSetRow["CODE"]) {
case 'PGRPSTRING':
if(params[dataSetRow["CODE"]].value !== null ) {
BirtStr.trim(params[dataSetRow["CODE"]].value).replace(/;/g, ",");
}else{
params[dataSetRow["CODE"]].value;
}
break;
case 'BEH_GROEP':
if(params[dataSetRow["CODE"]].value !== null ) {
BirtStr.trim(params[dataSetRow["CODE"]].value).replace(/;/g, ",");
}else{
params[dataSetRow["CODE"]].value;
}
break;
case 'PEILDATUM':
if(params[dataSetRow["CODE"]].value == null) {
dfd.format(BirtDateTime.today());
} else {
params[dataSetRow["CODE"]].value;
}
break;
case 'JAAR':
if(params[dataSetRow["CODE"]].value == null) {
if(params["PEILDATUM"].value == null) {
dfy.format(BirtDateTime.today());
} else {
pd = dfd.parse(params["PEILDATUM"].value)
dfy.format(pd);
}
} else {
params[dataSetRow["CODE"]].value;
}
break;
case 'PERIODENR':
if(params[dataSetRow["CODE"]].value == null) {
if(params["SRTPERIODE"].value == 'W') {
if(params["PEILDATUM"].value !== null) {
pd = dfd.parse(params["PEILDATUM"].value)
dfw.format(pd);
} else {
dfw.format(BirtDateTime.now());
}
}
if(params["SRTPERIODE"].value == 'M') {
if(params["PEILDATUM"].value !== null) {
pd = dfd.parse(params["PEILDATUM"].value)
dfm.format(pd);
} else {
dfm.format(BirtDateTime.now());
}
}
} else {
params[dataSetRow["CODE"]].value;
}
break;
case 'AANTAL':
if(params[dataSetRow["CODE"]].value == null) {
'0';
} else {
params[dataSetRow["CODE"]].value;
}
break;
case 'SRTPERIODE':
switch(params[dataSetRow["CODE"]].value) {
case 'W':
'W (Week)';
break;
case 'M':
'M (Month)';
break;
default :
'N/A';
break;
}
break;
default :
params[dataSetRow["CODE"]].value;
}
</pre>