on 10-21-2015 1:01 PM
Hi everyone,
I am new to SAP BO Design Studio.I have a start date ,end date,calendar date,current date,and have a from and to date propmts in the report.
I have to show by default 3 months data.I need this to dynamically change the current date and its previous 3 months.After that according to the strt date nd end date that is being selected,chart should get filtered.
How can I achieve this? I have referred How to use arrays for finding trailing months.
Regards
Archana
Dear all,
I tried using the above method which actually didn't work
I need to restrict the no of months to latest 3 months(current month),previous month and its previous month) for the first time login. This should happen dynamically.
I tried by referring "How to Use Arrays for trailing months". But still it didn't work. The month start date format of mine is in YYYY-MM-DD
Can anybody help me regarding this?
Archana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Archana
If I understand your scenario properly, your req is
Current date - 2015-11-04
you need to show by default From: 2015-09-04 TO:2015-11-04
In order to do this you can easily find the prev month and prev-1 month using the following logic.
All you need to do is take out the MM from your current date YYYY-MM-DD
So use a substring and get MM (this will be 11 in our scenario)
Now you need to find the prev month and its prev month
i will use the following local variable for explanation
currentmonth
prevmonth1
prevmonth2
currentyear
date
year
So now you have currentdate YYYY-MM-DD
Using Substring split them to YYYY , MM , DD
and convert them to integers and store them into the local variables
currentmonth=MM;
currentyear=YYYY;
date=currentyear;
Now check the following
if(currentmonth==2) /* if it is February the prevmonth2 will be in the prev year */
{
prevmonth1=01;
prevmonth2=12;
year=currentyear-1;
}
else if(currentmonth==1) /*If it is Jan , the prevmonth1 and prevmonht2 will be in the prev year */
{
prevmonth1=12;
prevmonht2=11;
year=currentyear-1;
}
else
{
prevmonth1=currentmonth-1;
prevmonth2-currentyear-2;
year=currenyear;
}
var Fromdate = year+"-"+prevmonth2+"-"+date;
Use filter now
DS.setfilter(Datedimension,{"low":FromDate,"high":currentdate});
I hope this helps
Thanks
Dear Vivek,
Current date can be find out using :
1) find application sys date
2)Split DD,MM,YYY from YYY-MM-DD and store it in local variables
3)Now apply prior date logic as above mentioned in Karthik's post.
4)Filter it in your data source accordingly.
Karthik had already explained here and you can find current date also refer his thread -How to use Arrays in SAP BO Design Studio for trailing months.
Regards
Archana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Simon,
Thanks for your immediate response.
I have implemented as:
1) Loading two datepropmpts with columns curr month nd prev month
2)As u told had defined two global variables X_from and X_to as default values of current nd prev mnth in Yyyy-mm-dd..as in backend format.
3)Set variable value to both current nd prev date
4)filtered data source from getting dates from datepropmts
5) ds_1.reloaddatasource()
But my doubt is hw will nxt tym on the new mnth strt date the data ll refresh..as wehve already set the default values..will it be a problem?
Regards
Archana
User | Count |
---|---|
86 | |
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.