Skip to Content
0

Cleaning Records with script logic QUESTION

Feb 09, 2017 at 12:49 AM

102

avatar image

Hello experts,

I have a problem caused because a template didn't refresh correctly. I haver Records for Entity A in Entity B with Cost Centers of A.

the Dimension Cost Center (CECO) has a property that makes reference to entity.

Here is an example of my records:

As you can see, I have records that must have only in MTYGA with MTYGA Cost Center in Entity CUUWY. I want to set that records with 0 value. For that I wrote the next code to make that record 0 but as you can see, the one that got the 0 value was the correct one:

//SCOPE
*XDIM_MEMBERSET CATEGORIA= Presupuesto
*XDIM_MEMBERSET HOTEL = %HOTEL_SET%
*XDIM_MEMBERSET PERIODO= %PERIODO_SET%
*XDIM_MEMBERSET ZRELACIONCTACEBE= NA_ZREL
*XDIM_MEMBERSET ZSTAGL= NA_ES
*XDIM_MEMBERSET CUENTAS= 0000650082


*SELECT (%CECOS%, ID, CECO, SEGMENT<>%HOTEL% AND CALC=N AND ID<>"NA_CECO")
*SELECT (%CEBES%, ID, CeBe, SEGMENT<>%HOTEL%) AND CALC=N AND ID <> "NA_CeBe")


*FOR %HOTEL%=%HOTEL_SET% //Limpia Hotel seleccionado
	*WHEN CeBe
		*IS %CEBES%
			*REC(EXPRESSION = %VALUE% * 0,CATEGORIA=Presupuesto)
	*ENDWHEN

	*WHEN CECO 
		*IS %CECOS%
			*REC(EXPRESSION = %VALUE% * 0,CATEGORIA=Presupuesto)
	*ENDWHEN
*NEXT

It seems that doesn't work because the 0 value is save in the scoped Entity and not in the wrong one.

Also I tried with other code:

//SCOPE
*XDIM_MEMBERSET CATEGORIA= Presupuesto
*XDIM_MEMBERSET HOTEL = %HOTEL_SET%
*XDIM_MEMBERSET PERIODO= %PERIODO_SET%


	*FOR %HOTEL%=%HOTEL_SET% //Limpia Hotel seleccionado
		      *WHEN CeBe
			 *IS <> "NA_CeBe"
		           *WHEN CeBe.SEGMENT
			      *IS %HOTEL%
				*ELSE
	    *REC(EXPRESSION = %VALUE% * 0,CATEGORIA=Presupuesto, HOTEL=%HOTEL%)
		*ENDWHEN
		*ENDWHEN


		*WHEN CECO 
			*IS <> "NA_CECO"
				*WHEN CECO.SEGMENT
					*IS %HOTEL%
				*ELSE
					*REC(EXPRESSION = %VALUE% * 0,CATEGORIA=Presupuesto, HOTEL=%HOTEL%)
                *ENDWHEN
         *ENDWHEN
	*NEXT

This last code seems that doesn't work because i don't scope the Entity that has the wrong record.

Is it a way to scope the worng entity if the user selects the entity that wants to clean ?

Thanks for the posts.

Best regards.

records.jpg (90.0 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

sakshi Jain May 01, 2017 at 06:14 AM
1

" I have a problem caused because a template didn't refresh correctly."

From this statement it seems you have a one time mistake and you want to clean the data. Is that correct? To clear such records you can use "CLEAR" package with your selection ! Also If there are many combinations of such records, you could download them in a flat file, and reverse the signs of the signdata and upload the file flat file as transaction data, followed by lite optimize.

Show 5 Share
10 |10000 characters needed characters left characters exceeded

"CLEAR" package do not support conditional deleting based on property...

0

I am not suggesting to use CLEAR based on property, but if it is possible to identify clearly which records have to be deleted, then using CLEAR with full criteria.

0

The question author is talking about the case when records for deletion are identified by combination of member ID and property:

Like:

Delete records with cost center entity property not equal to the entity dimension member.

In this case standard CLEAR package is useless.

0

It can be done with the clear DM, but there are lots of combinations. The solution wante do developed was a script logic to clear the data. Indeed is a problem when refreshing the template. To solve that I set the template to refresh each time it opens.

0

Not clear... "To solve that I set the template to refresh each time it opens." - how it's related to the script???

Please clearly define what do you want to clear! Detailed algorithm!

0
Vadim Kalinin Mar 08, 2017 at 04:08 PM
0

Not clear requirements:

"As you can see, I have records that must have only in MTYGA with MTYGA Cost Center in Entity CUUWY. I want to set that records with 0 value."

I want to set that records with 0 value - what for???

I have alerted moderator to correct the primary tag!

Share
10 |10000 characters needed characters left characters exceeded