cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Dates in Design Studio

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Dear Karthik,

Thank you so much for your time and effort

It helped me a lot with your detailed explanation. This will help a lot of people.

Regards

Archana

Former Member
0 Kudos

Hi everyone

Can anyone help me to find prior date from current System date in Design Studio !!

ie if current date is 25/11/2015, my Prior date 'text box' should display 24/11/2015.

also if current date is 1/12/2015, Prior date should be 30/11/2015.

Thanks in advance.

Vivek

Former Member
0 Kudos

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

Answers (1)

Answers (1)

former_member192995
Participant
0 Kudos

Hi Archana,

have a look on this site:

regards

Simon

Former Member
0 Kudos

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