cancel
Showing results for 
Search instead for 
Did you mean: 

Fetch 'Time' from the context

Former Member
0 Kudos

Hi All,

I have written a script logic for copying data to multiple destinations. I want to now fetch the source time which was set in context while running the logic.

After i get the time, I will copy same data to 3,6,9,12 months of next year. Which means ultimately I want to achieve the source year.

Please suggest a solution as soon as you can.

Regards,

Mayank

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Hi Mayank,

You have 2 options:

1. Simple. Pass the context time member as a default for SELECTINPUT prompt:

PROMPT(SELECTINPUT, [variable], , [label], [dimensions],,[default members])

where default members=1 to get member from context

2. Use

Vadim

Former Member
0 Kudos

Hi Vadim,

 

PROMPT(SELECTINPUT,%SOURCE%,,Source Time,"%TIME_DIM%",1)

This is how I am trying to do it, please make changes in the above line to correct it because this is not picking default time.

Regards,

Mayank

former_member186338
Active Contributor
0 Kudos

Undocumented extra comma required after dimension and "Source Time":

PROMPT(SELECTINPUT,%SOURCE%,,"Source Time","%TIME_DIM%",,1)

Former Member
0 Kudos

This is helping me Vadim, Can I do anything to disable the user from changing the default time.

Though that is complusory but still I want to know can we do it?

former_member186338
Active Contributor
0 Kudos

Unfortunately you can't disable the user from changing the default time. Only if you go to option 2 in my proposal.

Former Member
0 Kudos

  This is the DM Script I am using but I am getting an error while running the logic, Please help.

 

RUN_LOGIC:Dimension set:"TIME" not assigned in Data Manager

model: PAYROLL_BUDGET. Package status: ERROR

PROMPT

(SELECTINPUT,%SOURCE%,,Source Time,"%TIME_DIM%",,1)

 

INFO

(%EQU%,=)

 

TASK

(/CPMB/DEFAULT_FORMULAS_LOGIC,EQU,%EQU%

 

TASK

(/CPMB/DEFAULT_FORMULAS_LOGIC,SUSER,%USER%)

 

TASK

(/CPMB/DEFAULT_FORMULAS_LOGIC,SAPPSET,%APPSET%)

 

TASK

(/CPMB/DEFAULT_FORMULAS_LOGIC,SAPP,%APP%)

 

TASK

(/CPMB/DEFAULT_FORMULAS_LOGIC,MEMBERSELECTION,SOURCE%EQU%%SOURCE%)

 

TASK

(/CPMB/DEFAULT_FORMULAS_LOGIC,LOGICFILENAME,PAYROLL_NEW.LGF)

RUN_LOGIC:Dimension set:"TIME" not assigned in Data Manager

model: PAYROLL_BUDGET. Package status: ERROR

former_member186338
Active Contributor
0 Kudos

First, please correct - add " before and after Source Time as I mentioned in prev post:

PROMPT (SELECTINPUT,%SOURCE%,,"Source Time","%TIME_DIM%",,1)

Second:

Provide the script text:

You have to use $SOURCE$ variable in the script.

Vadim

Former Member
0 Kudos

Hi Vadim,

Is there any way to track system current year in script logic. Any way by which I can directly fetch system year?

Regards,

Mayank

former_member186338
Active Contributor
0 Kudos

Special variable %YEAR% - Returns the current calendar year

But in some cases it can be dangerous to use this variable (during year closing)

Vadim

Former Member
0 Kudos

1) I am not able to use %YEAR%, I also read it somewhere but unable to use.

2) I will tell you complete scenario, may be then you can help me.

I am loading data from BI to BPC for some combination of dimensions to one dummy cost center and forecast category, then I am copying that data for same combination to all the cost centers.

Now I need to copy the same data to all the cost centers in Budget Category but this time, time would be source year+1.03, source year+1.06, .09 and.12. Which means I need to find out the source year for which the data is loading from BI ti BPC.

Assuming that year to be same year as current year I thought of using System year.

Now please help me with it.

former_member186338
Active Contributor
0 Kudos

Please provide you script text!

Former Member
0 Kudos

*SELECT(%Y%, "YEAR", "TIME", "[ID] = '%YEAR%'")

*SELECT(%H%,"[ID]",HR_ACCOUNT,"[ID]<>Shift,Education_Assist")

*XDIM_MEMBERSET HR_ACCOUNT=%H%


*XDIM_MEMBERSET ENTITY AS %ENTITYLIST%=BAS(1000)

*XDIM_MEMBERSET BUDGET_VER = Final

*WHEN CURR

*IS AED

*WHEN TIME

*IS *

*WHEN ENTITY

*IS 1000_I

*WHEN DATASOURCE

*IS Pay_Plan_New

*WHEN CATEGORY

*IS Forecast


*FOR %E%=%ENTITYLIST%

*REC(EXPRESSION=%VALUE%,CATEGORY=Forecast,ENTITY=%E%,DATASOURCE=Pay_Plan_New)
*REC(EXPRESSION=%VALUE%,CATEGORY=Forecast,ENTITY=%E%,DATASOURCE=Pay_Plan_Retired)

*FOR %M%=03,06,09,12

*REC(EXPRESSION=%VALUE%,CATEGORY=Budget,TIME=TMVL(13,%Y%.%M%),ENTITY=%E%,DATASOURCE=Pay_Plan_New)
*REC(EXPRESSION=%VALUE%,CATEGORY=Budget,TIME=TMVL(13,%Y%.%M%),ENTITY=%E%,DATASOURCE=Pay_Plan_Retired)

*NEXT


*NEXT

*ENDWHEN

*ENDWHEN


*ENDWHEN

*ENDWHEN

*ENDWHEN

former_member186338
Active Contributor
0 Kudos

Unfortunately %YEAR% variable is assigned after SELECT or TMVL is processed. In your case you can't use this variable in this code. If we return back to %SOURCE% DM advanced script var then it will be passed as $SOURCE$ to the script:

*SELECT(%Y%, "[YEAR]", TIME, "[ID] = '$SOURCE$'")

Vadim

Former Member
0 Kudos

Yes this can be done Vadim but these packages will be scheduled to run automatically daily, so when it takes time from the context, the time in the context and the time for which data got loaded could be different, and the logic may fail.

So, will it be right to take it from context?

Is there any other way of tracking time for which data is getting loaded? I mean the time in BI.

former_member186338
Active Contributor
0 Kudos

If you want to schedule some package to run daily, then it will get TIME from context only once. In this case you don't need to get time member from context, just ask user to type year once in the PROMPT(TEXT,... and pass it using REPLACEPARAM to the script $$ variable. At the moment of year change you have to reschedule the package with the new year value...

Vadim

P.S. You can also modify RUNLOGIC_PH badi to launch script with current year parameter filled in the badi code.

Answers (1)

Answers (1)

Piyushmatrixs
Participant
0 Kudos

Hi,

Can you more elaborate it?

Regards

Piyush