Fetching month and year from CV of Time dim
Hi,
I am working on BPC 7 MS version, SP3. I need to fetch Month and Year values from my Current View (i.e., %TIME_SET%) .... and if the month is AUG and year is Current I then want a logic to run... Is this possible??
I have written the following code, and only if i hardcode the time (WHEN TIME IS 2009.AUG) the logic seems to work. But I want it to be dynamic
*XDIM_MEMBERSET ACCOUNT=INC_REC_IN_AD
*XDIM_MEMBERSET TIME=%YEAR%.AUG,%TIME_SET%
*XDIM_MEMBERSET CATEGORY=ACTUAL
*WHEN ACCOUNT
*IS *
*WHEN TIME.MONTHNUM
*IS 8
*FOR %YEAR%=%TIME_SET%.YEAR
*FOR %MONTH%=AUG,SEP,OCT,NOV,DEC
*REC(FACTOR=1/5,TIME="%YEAR%.%MONTH%",ACCOUNT="TEMPSTUDYEDU")
*NEXT
*NEXT
*ENDWHEN
*ENDWHEN
*COMMIT
Thanks,
Prasanth.
I think your formula is correc the %YEAR% is not a valid, Can you trap that and see what is being passed, you may also try to split the year out of %TIME%
hope it helps.
Similar Messages
-
Getting Day, month and year from Date object
hello everybody,
Date mydate = Resultset.getDate(indexField);
Now i would like to get day, month and year from mydate.
In another words, i'm looking for something equivalent to
mydate.getDay() as this method is deprecated.
Can somebody help me out please?
Thank you in advance,swvc2000,
Here is a sample class that demonstrates two ways in which to do this.import java.util.*;
import java.text.*;
public class DateSplitter {
public static void main(String args[]) {
/* even though your date is from a result set,
pretend the following date is your date that
you are using. The try catch block is used
because I hand-crafted my date using
SimpleDateFormat. Substitute your date.*/
Date yourDate = null;
try {
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
yourDate = formatter.parse("05/06/2000");
} catch (ParseException e) { }
//the following gets the current date
Calendar c = Calendar.getInstance();
//use the calendar object to set it to your date
c.setTime(yourDate);
//note months start at zero
int month = c.get(Calendar.MONTH);
int year = c.get(Calendar.YEAR);
int dayOfMonth = c.get(Calendar.DAY_OF_MONTH);
System.out.println("Calendar Month: "+month);
System.out.println("Calendar Day: "+dayOfMonth);
System.out.println("Calendar Year: "+year);
System.out.println();
/* Simple date format can also be used to strip them
out of your date object. When you use it, notice that
months start at 1. Also, it returns string values. If
you need integer values, you will have to use
Integer.parseInt() as I did below. If you are
only concerned about the string values, just remove
the Integer.parseInt part. */
DateFormat formatter = new SimpleDateFormat("M");
month = Integer.parseInt(formatter.format(yourDate));
System.out.println("SDF Month: "+ month);
formatter = new SimpleDateFormat("d");
dayOfMonth = Integer.parseInt(formatter.format(yourDate));
System.out.println("SDF Day: "+ dayOfMonth);
formatter = new SimpleDateFormat("yyyy");
year = Integer.parseInt(formatter.format(yourDate));
System.out.println("SDF Year: "+ year);
}//end main
}//end DateSplitter classtajenkins -
Get month and year from date type
Hi all,
I need to get the month and year from the date type.
For example select to_date('2011-01-17', 'yyyy-mm-dd') from dual;Result needed:
01-2011Any ideas?
thanks in advance,
Bahchevanov.Hello Bahchevanov,
if you need the date to compute something, then you can
TRUNC(SYSDATE,'mm')This will give you a date with the days removed -> 01.01.2011
Regards
Marcus -
Hi,
I have requirement to get max month and year from a table.
DESC WHR_REPORT
REPORTMONTH NUMBER(2)
REPORTYEAR NUMBER(4)
Sample data in table
reportmonth reportyear
01 2009
02 2009
03 2009
04 2009
09 2009
12 2009
01 2010
02 2010how do i get the max date which means 022010 from the table?
thanks
sandyGive this a shot:
SQL> WITH whr_report AS
2 (
3 SELECT 01 AS reportmonth, 2009 AS reportyear FROM DUAL UNION ALL
4 SELECT 02 AS reportmonth, 2009 AS reportyear FROM DUAL UNION ALL
5 SELECT 03 AS reportmonth, 2009 AS reportyear FROM DUAL UNION ALL
6 SELECT 04 AS reportmonth, 2009 AS reportyear FROM DUAL UNION ALL
7 SELECT 09 AS reportmonth, 2009 AS reportyear FROM DUAL UNION ALL
8 SELECT 12 AS reportmonth, 2009 AS reportyear FROM DUAL UNION ALL
9 SELECT 01 AS reportmonth, 2010 AS reportyear FROM DUAL UNION ALL
10 SELECT 02 AS reportmonth, 2010 AS reportyear FROM DUAL
11 )
12 -- END SAMPLE DATA
13 SELECT MAX
14 (
15 TO_DATE
16 (
17 LPAD
18 ( reportmonth
19 , 2
20 , '0'
21 ) || reportyear
22 , 'MMYYYY'
23 )
24 ) AS MAX_DT
25 FROM whr_report
26 /
MAX_DT
02/01/2010 00:00:00This is a case where you should use the correct data types to store data. These two column should be ONE column with a data type of DATE. -
When my delegates are filling in a event form i have put together, a large number of them forget to change either the month or year on the date field. Is there a way to have a date field that has drop down boxes for day, month and year so they have to choose rather than a date been already on the screen??
ThanksHi Christopher,
The WEEKDAY function allows specifying either Sunday or Monday as the first day of the week:
WEEKDAY
The WEEKDAY function returns a number that is the day of the week for a given date. WEEKDAY(date, first-day)
 date: The date the function should use. date is a date/time value. The time portion is ignored by this function.
 first-day: An optional value that specifies how days are numbered.
Sunday is 1 (1 or omitted): Sunday is the first day (day 1) of the week and Saturday is day 7.
Monday is 1 (2): Monday is the first day (day 1) of the week and Sunday is day 7. Monday is 0 (3): Monday is the first day (day 0) of the week and Sunday is day 6.
But I think you are referring to the first day of the 'workweek', for which I do not see a means of defining a custom value.
Since you want to 'insert categories', though, you could easily define your own, using WEEKDAY(date) or WEEKDAY(date,1), plus an IF statement to return the category label appropriate to the day. Here's one for a Sunday to Thursday work week. Dates are in column A, the formula is in whichever column you want as the Category column. For the example, I've placed it in column B.
B2, and filled down: =IF(WEEKDAY(A)<6,"Work","Off")
The top table shows the weekday numbers returned for each day of the week for each of the three permitted values for the optional second argument. The bottom table shows the results from the formula above, used to define a category label for each date:
A10 was left blank intentionally, to determine if the lack of data resulted in an error. The Warning message, flagged by the blue 'warning' triangle, is "The formula uses a number in place of a date." The 'date' assigned to this numerical value of zero was a Friday, but I'm not certain when. Probably best to avoid extra rows with no date shown.
Regards,
Barry -
Problem in conversion of month and year from R/3 into 0calmonth of BI
Hi,
I have to convert two fields of R/3 Calendar month and year into one field of Calendar year/month of BI.
How can i do this..... i have tried using concatenation formula in transformation rules but its not working and converting 09, 2006 into 06.2009.
Please help me if you guys have any idea.
regardsWhy do you want to combine CALMONTH and CALYEAR ??
CALMONTH will give you both month and year (eg: 09.2007)
you can directly map (R/3)KMONTH to 0CALMONTH(BI). -
How to get the currrent month and year from a new date object
If I create a new Date object as "d",
java.util.Date d = new java.util.Date();how can I format the date to get the current Month as 'Jan' and the current year as '2008'. So if I have something like d.getMonth() gets the current month as 'Oct' and d.getYear() gets '2008'
Thanks,
Zub[Read the flamin' manual you must. Hmm.|http://en.wikipedia.org/wiki/RTFM]
~~ Yoda.
Well no actually, he didn't say that, but he should have.
Cheers. Keith.
PS: Don't say that to a 7 foot pissedOff wookie when he's got his head stuck in a smoking hyperdrive, and you're being chased by a S-class battle cruiser... Ask Yoda how he got to be so short.
PPS: It is the SimpleDateFormat you seek ;-)
Edited by: corlettk on 14/10/2008 22:37 ~~ Also far to slow... but funny. -
Problem to insert only month and year instead of full date
select b.penjara_id, p.penj_lokasi, a.no_daftar, b.episod, b.nama1,to_char(a.trkh_mula_prl,'dd/mm/yyyy') as trkh_mula_prl, to_char(bulan_proses,'mm/yyyy') as bulan_proses,
b.epd, b.lpd
from prl_daftar_proses a, senarai_pesalah b, penjara p
where a.no_daftar=b.no_daftar
and a.episod=b.episod
and b.penjara_id = p.penjara_id
and a.setuju_jplp is null
and a.bulan_proses between to_date(:FROM,'dd/mm/yyyy') and to_date(:TO,'dd/mm/yyyy')
order by b.penjara_id, a.bulan_proses,a.no_daftarHi,anyone can help me how i can insert only month and year from the value that have full date in the database??
for example,the date is 09/18/2012, but i just want to insert 09/2012 as parameter. If i want to insert only one parameter, i can do that..But i have problem when I want to insert two parameters..jeneesh wrote:
Welcome to the forum..
This..?
Assuming bulan_proses is a date without time part
select b.penjara_id, p.penj_lokasi, a.no_daftar, b.episod, b.nama1,to_char(a.trkh_mula_prl,'dd/mm/yyyy') as trkh_mula_prl, to_char(bulan_proses,'mm/yyyy') as bulan_proses,
b.epd, b.lpd
from prl_daftar_proses a, senarai_pesalah b, penjara p
where a.no_daftar=b.no_daftar
and a.episod=b.episod
and b.penjara_id = p.penjara_id
and a.setuju_jplp is null
and a.bulan_proses between to_date(:FROM,'mm/yyyy') and last_day(to_date(:TO,'mm/yyyy'))
order by b.penjara_id, a.bulan_proses,a.no_daftar
i got another problem..
before that.may i know what is the function of last_day? -
To get first date and end date after entering any month and year
Hi,
I need to to get first date and end date of a month and year in yyyyMMdd format. I am reading month and year from a properties file. But I don't know how to get the first date and End date in given format. The properties file gives me just text. But I don't know how to get the date format using this. I need this urgently. Can anyone help me to get code for this?
I am reading the fields as,
Properties props = new Properties();
props.load(new FileInputStream("AnyMonthVolume.properties"));
String date_month = props.getProperty("date_month");
String date_year = props.getProperty("date_year");
Thanks.I know this has been posted a while ago but incase someone looking for it, here is the code to get the end of current month date.
Calendar cal = Calendar.getInstance();
cal.setTime(new java.util.Date());
cal.set(Calendar.DATE, 1); //set the date to start of month
cal.add(Calendar.MONTH,1);
cal.add(Calendar.DATE,-1);
System.out.println(cal.getTime()); -
How i can get list of months and years from my tables(ex. tab1), when i have start date ex. 072003 and end date ex. 042005 . That i use in report 6i.. . .
months | years| . . . . .
----------------------------------If i am not wrong you want these result
SQL> SELECT hiredate FROM emp;
HIREDATE
17-DEC-80
20-FEB-81
22-FEB-81
02-APR-81
28-SEP-81
01-MAY-81
09-JUN-81
19-APR-87
17-NOV-81
08-SEP-81
23-MAY-87
03-DEC-81
03-DEC-81
23-JAN-82
14 rows selected.
SQL> INSERT INTO emp (empno,hiredate,deptno) VALUES (1,SYSDATE,10);
1 row created.
SQL> COMMIT;
Commit complete.
SQL> SELECT hiredate FROM emp;
HIREDATE
17-DEC-80
20-FEB-81
22-FEB-81
02-APR-81
28-SEP-81
01-MAY-81
09-JUN-81
19-APR-87
17-NOV-81
08-SEP-81
23-MAY-87
03-DEC-81
03-DEC-81
23-JAN-82
01-SEP-06
15 rows selected.
SQL> SELECT TO_CHAR(a,'MON-YYYY') b FROM
2 (SELECT ADD_MONTHS(TRUNC(sysdate,'YYYY'),(rn.r-1)) a FROM
3 (SELECT ROWNUM r FROM user_objects WHERE ROWNUM<=12) rn)
4 MINUS
5 SELECT TO_CHAR(hiredate,'MON-YYYY') FROM emp;
B
APR-2006
AUG-2006
DEC-2006
FEB-2006
JAN-2006
JUL-2006
JUN-2006
MAR-2006
MAY-2006
NOV-2006
OCT-2006
11 rows selected.
SQL> SELECT b FROM
2 (SELECT TO_CHAR(a,'MON-YYYY') b FROM
3 (SELECT ADD_MONTHS(TRUNC(sysdate,'YYYY'),(rn.r-1)) a FROM
4 (SELECT ROWNUM r FROM user_objects WHERE ROWNUM<=12) rn)
5 MINUS
6 SELECT TO_CHAR(hiredate,'MON-YYYY') FROM emp)
7 WHERE b BETWEEN 'NOV-2006' AND 'SEP-2006';
B
NOV-2006
OCT-2006
SQL> Khurram -
SQL select Statement -first day and last day of the month - 1 year from now
Hi,
I need to write a SQL to get the dates in between first day and last day of the month one year from now.
SELECT last_day(add_months(sysdate,12)) as lastday from dual
What could be the Query to get the first day of the month one year from now..
ie ..Sysdate - 3-DEC-2009
Result - 1-DEC-2010
thank youHi,
You can use TRUNC with 2 arguments to get the first DATE in a month, year, quarter, week, hour, minute, ISO year, ...
SELECT TRUNC ( ADD_MONTHS ( SYSDATE
, 12
, 'MONTH'
) AS first_of_month
FROM dual
;The DATE returned will be in the same month, year, quearter, ... as the first argument.
\We convered the last day of the month in [your previous question|http://forums.oracle.com/forums/message.jspa?messageID=3942939#3942939].
At that time, I warded about using LAST_DAY as a cutoff point; TRUNC is a much better way.
For example, to find all appointment_dates in the current month next year:
SELECT *
FROM appointments
WHERE appointment_date >= TRUNC (ADD_MONTHS (SYSDATE, 12), 'MONTH')
AND appointment_date < TRUNC (ADD_MONTHS (SYSDATE, 13), 'MONTH')Note that
the first part of the WHERE clause calls for dates on or equal to the beginning of the 12th month in the future, but
the second part of the WHERE clause calls for dates before, not equal to , the beginning of the 13th month in the future. -
How to get Week,Month and Year details from a date column
Hi frenz,
I've a column like tran_date which is a date column..... I need the next week details based on this column and so on...
I need month and year details as well based on this tran_date column.... can any one tell me how...
Thanks in advanceMy example for objects:
create or replace type date_object as object
centure number,
year number,
month number,
day number,
hour number,
minute number,
second number,
daypart number,
week number,
constructor function date_object(p_dt date)
return SELF as result
create or replace type body date_object is
constructor function date_object(p_dt date)
return SELF as result
as
begin
SELF.centure:= trunc(to_char(p_dt,'YYYY')/100);
SELF.year:= to_char(p_dt,'YYYY');
SELF.month:= to_char(p_dt,'MM');
SELF.day:= to_char(p_dt,'DD');
SELF.hour:= to_char(p_dt,'HH24');
SELF.minute:= to_char(p_dt,'MI');
SELF.second:= to_char(p_dt,'SS');
SELF.daypart:= p_dt-trunc(p_dt,'DD');
SELF.week:= to_char(p_dt,'IW');
return;
end;
end;
select date_object(sysdate),
date_object(sysdate).year
from dual;Regards,
Sayan M. -
Elapse days - calculation from month and year
Duplicate thread ...
coding required for converting month into days
I have Month and year field in my DSO --Year( 2009), Month(4)
I want below logic to calculate -
MTD qty % = (qty * elapse days) / no of days in month
so from the above, I want to know,
1. How can we get the no of days from the above 2 objects (year and month).
2. Elapse days are the days that are over from current date to Ist day of that month.
eg: current date - 04.03.2009 , 1st day of the month - 04.01.2009,
elapse days = 2. (you need to consider all days in the month, not only working days)
so my questions is how can we get, # of days n a month from above 2 fields and elapse days based on the above condition.
also want to know, where can I have the logic in transformations or query level.
please provide your suggestions.
Thanks,
Pra
Edited by: Arun Varadarajan on Apr 5, 2009 10:44 PM
Edited by: Arun Varadarajan on Apr 5, 2009 10:45 PMHello,
I think the sample program below does what you ask: it finds the days in the month (bit of an overkill to use function modules for that) and then computes the QTD.
Note that the internal string representation of a data variable is always YYYYMMDD, regardless of the "externalized" form (e.g. yyyy/mm/dd or dd.mm.yyyy), so this code will work regardless of your custom date format.
Regards,
Mark
REPORT zqty_to_date.
PARAMETERS:
p_date TYPE dats,
p_qty TYPE i.
DATA:
days TYPE i,
n_year TYPE numc4,
n_month TYPE numc2,
n_day TYPE numc2,
qtd(6) TYPE p DECIMALS 1.
START-OF-SELECTION.
n_year = p_date+0(4).
n_month = p_date+4(2).
n_day = p_date+6(2).
PERFORM days_in_month USING n_year n_month CHANGING days.
qtd = ( p_qty * ( n_day - 1 ) ) / days.
WRITE: / 'Days in month:', days,
/ 'Qty to date :', qtd.
*& Form days_in_month
* text
FORM days_in_month USING year month CHANGING days.
DATA: ymod4 TYPE i,
ymod100 TYPE i,
ymod400 TYPE i.
CASE month.
WHEN 4 OR 6 OR 9 OR 11.
days = 30.
WHEN 2.
ymod4 = year MOD 4.
ymod100 = year MOD 100.
ymod400 = year MOD 400.
IF ( ymod4 = 0 AND ymod100 > 0 ) OR ( ymod100 = 0 AND ymod400 = 0 ).
days = 29.
ELSE.
days = 28.
ENDIF.
WHEN OTHERS.
days = 31.
ENDCASE.
ENDFORM. "days_in_month -
Hide days from WebElements component WECalendar (show only month and year)
Dear expert,
I'm using WebElements to replace standard InfoView parameter screen for my Crystal Reports. My question is:
1. Is it possible to customize WebElements component: WECalendar so that we only see Month and Year, but not the Days (in other words to hide the days from the calendar).
If not possible then is there any other WebElements component that i can use for this purpose?
Because i only need to pass value of month and year selected by user when jumping to other report (using OpenDocument).
2. When i looked at the code, i'm afraid the only way is by editing the HTML part that is marked with:
// *** do not modify the code below
Since there's no available variables for hiding the days in the section that can be modified:
// *** the code below can be modified to change the formatting to the desired look and feel
Below is some of the code of the WECalendar component:
Function (stringvar ElementName, datevar ElementDefault, stringvar MonthDisplays, stringvar DayDisplays)
// *** the code below can be modified to change the formatting to the desired look and feel
// calendars use the stringvars below if nothing is entered into the WECalendar function for these parameters
if DayDisplays="" then DayDisplays:= 'Su|Mo|Tu|We|Th|Fr|Sa'; // note that there must be two characters for each day...or use " " as in 'S |M |T |W |T |F |S '
if MonthDisplays="" then MonthDisplays:= 'January|February|March|April|May|June|July|August|September|October|November|December';
// the font below is for the month & year display in the calendar and can be modified
stringvar headerfont:= WEFont('Verdana', 11, 'Navy', '', true, false,"","");
// the font colour and size below can be modified...this is for the arrows that change the month or year of the calendar
stringvar arrowfont:= WEFont('Arial', 10, 'Gray', '', false, false,"","");
// these fonts for the calendar days must be a fixed width font such as Lucida Console or the calendar spacing will break
stringvar datefont:= WEFont('Lucida Console', 8, 'Black', '', false, false,"","");
stringvar daystringfont:= WEFont('Lucida Console', 8, 'Black', '', false, false,"underline","");
stringvar weekendfont:= WEFont('Lucida Console', 8, 'Gray', '', false, false,"","");
stringvar inputfont:= WEFont('Lucida Console', 8, 'Navy', 'Center', false, false,"","");
// *** do not modify the code below
Thank you very much.
Kind regards,
aswin
Edited by: Aswin Setyawan Margono on Feb 2, 2011 5:16 PMhi Aswin,
you can always modify any of the webelements controls or create your own if you're feeling adventurous. the "do not modify" is just a warning that the code below is not as customizable as the code above which is made to be easily changed.
my recommendation for an easy win in your case though is to use the weSelectDuo control having years in the first of the select menus and the months in the second select menu.
cheers,
jamie -
Displaying dates from 1 to 31/30/28 depending on month and year
Hi all,
I am working on oracle 10g, how can i display set of dates from (1 to 30) depending on month and year eg, for nov month if i run the query.. the output should be:
1
2
3
30
and this should be accomplished only by using SQL
Regards,
Sreekanth.something like:
select level from dual
connect by level <= to_number(to_char(last_day(to_date('NOV-2009', 'MON-YYYY')), 'DD'))
/
Maybe you are looking for
-
I did a software upgrade to IOS6 and my Iphone4S is now unable to update. Do I lose all my contacts and calendar entries when I restore?
-
Error SP2-0027 while using explain plan
I'm using explain paln command in order to get the tables acceeded by a SQL query. When I use the command with some of them, that's OK. But when I use it with a query of 4999 characters, it gives me this error message: SP2-0027: Input is too long (>
-
When I run a form with Webutil, it gives the following error. WUC-015: Your Form must contain the following Bean for this function to be available: oracle.forms.webutil.clientinfo.GetClientInfo How do I make this bean available to the form ? Thanking
-
What is the best way to deal with....
i have a large training document with a main body of text with each paragraph apllicable to various groups within the organisation for example train managers this is example main text this is example main text this is example ma
-
Why can't I import photos from desktop
I am unable to import photos into my iphoto from my desktop. An error comes up after I file/import/desktop/photo saying this: unrecognized file type, the following files cannot be imported (they may be an unrecognized file type or the files may not c