cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamic Data copy script is not working

praveen_kumar334
Participant
0 Likes
1,397

Hi Team,

I am trying to create a dynamic copy Data Action. The Data Action should Copy Actual data from the FromYear to the ToYear of the chosen Plan Version.

I have parameters for TargetVersion, FromYear and ToYear that I want to use for a dynamic copy. Could you please help me with the script code.

View Entire Topic
N1kh1l
Active Contributor

praveen.kumar334

I would still prefer the Standard Data Copy Action for any Dynamic copying of records but If you really want to use the script to achieve it you can try the below approach.Adjust the Parameter ToYear to only select leaf member and cardinality one.

Now you can use below script to copy the data. I am just copying one measure "QUANTITY" for example.

MEMBERSET [d/MEASURES] = "QUANTITY"
MEMBERSET [d/Date] = BASEMEMBER([d/Date] ,%FromYear% )

INTEGER @PERIOD

//-----------------------------------------------------------------------------------
//Calculation and Data Writing
//-----------------------------------------------------------------------------------
FOREACH [d/Date]
	@PERIOD=YEAR(%ToYear%)-YEAR([d/Date])
	DATA([d/Date]=NEXT(@PERIOD,"YEAR",[d/Date]))=RESULTLOOKUP([d/Version]="public.Actual")

	
ENDFOR

Data Action Prompts for run. For ToYear, any month of the destination Year has to be selected.

Output

Hope this helps !!

Please upvote/accept if this helps.

Nikhil