on 05-05-2006 10:20 AM
Hi All,
Iam having a requirement where in during the execution of a Query, my user would enter the value for Calender date,
then my report should bring the data for same date for previous months.
Say for eg: if my user enters 27th April 2006, then my report should have data for 27th March 2006, 27th Feb 2006, 27th jan2006...... 27th April 2005.
can anyone help me in this regard.
Thanks and regards,
Manick
Hi Manick,
You can use offsets or you can use CMOD on the variables.
Robably it is better with offsets.
Let me know if you need more information.
Ciao.
Riccardo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manick,
The logic is the following.
You have a user entry variable. Create 11 customer exit variables. Determine the month of this date (5th & 6th characters) and the year (first 4 characters).
In the exit subtract the number of month (1,2... 11) depending on the variable from the determined date month.
If the result of subtraction is less or equal zero, add 12 and subtract 1 from determined year.
Then replace by the month and year the appropriate parts of the entered date.
Create a structure in columns. In each selection put your KF and 0CALDAY restricted by appropriate variable.
Think it over what you will do if the user enters 31 day of the month (not all month have so many days).
Search forums for the code samples. Believe with them you'll be able to write the code by yourself.
Best regards,
Eugene
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Meiappan ,
curious that there is such a request for a report .. what happens for dates like 31st Jan ? or 30th April ... which would invalidate February , and other months without 31 days ...?
Is this a case for client education ? and keeping this in mind , should the report calculate for the last 30 days or the same date last month ?
Calculating for the value 30 days before is much easier , make the client see reason in the same instead of some convoluted logic for arriving at the right date.
Hope this helps ...
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
My requirement doesn`t bother about the number of days in a month...
instead the user must be able to compare his sales for the same date last monthsss...
The number of previous month required is constant say for eg 12...
i tried the same using offset variables... i was only able to get the previous month alone and not for previous 12 months...
can this achieved using offset variable...???
if we have to write exit, then can anyone give a sample code for this case...
Regards,
Manick
Meiappan ,
I am not sure if you got my question ,
what happens if the user enters 31st March , what will the previous column be ? 31st february ?? ... the gregorian calendar would turn in its grave!!! and in all likelihood you will get a short dump if you do not provide for this logic.
how do you intend to resolve that ? accordingly any exit / offset / variable logic will have to be written.
My 0.02
Arun Varadarajan
Hi
is the no of previuos months are fixed, then create a variable on date and use the offset.
Hope this helps
Shiva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.