(Note: This same post can be found here: Advice on smart use of DATACOPY . Reposting in OTN for wider cast)
Hi all,
I'm looking for advice on how to improve my code regarding the use of DATACOPY.
I have a sparse dimension that looks similar to this:
RootMbr
Parent_1
Legacy_1
Child_1_1
Child_1_2
Child_1_3
Parent_2
Legacy_2
Child_2_1
Child_2_2
Child_2_3
Parent_3
Legacy_3
Child_3_1
Child_3_2
Child_3_3
Parent_...
I'm not getting into details, but at some point I need the parent value of Parent_X to be copied to Legacy_X
I first solved this using the following:
FIX(@MATCH(SparseDim,"Legacy*")
@PARENTVAL(SparseDim,@CURRMBR(SparseDim));
ENDFIX
And that works perfectly, but now I've realized blocks are not being created for Legacy* members, and using block member calculations cannot be done this time (for reasons I'm not detailing now).
So, I consider using DATACOPY to force the creation of blocks, but something like
DATACOPY @PARENTVAL(SparseDim,@CURRMBR(SparseDim)) TO @CURRMBR(SparseDim);
is giving the fllowing error:
Error: 1012001 Invalid Calc Script syntax [
DATACOPY @PARENTVAL]
I get the same if I use @PARENT instead, so it looks like my only option would be something like this:
DATACOPY Parent_1 TO Legacy_1;
DATACOPY Parent_2 TO Legacy_2;
DATACOPY...
but I'd hate having to do that. It looks terribly awful.
Notice that in this example I made the Parent_X and the Legacy_X match their sufixes (X) for better understanding, but this does not always happen. Nonetheless, the first child under a parent will always start by "Legacy*"
I also tried using @CREATEBLOCK, but it didn't seem to work.
Version is on-premise 11.1.2.4, but I asume this should be the same for PBCS.
Any ideas?
G.S.Feliu