cancel
Showing results for 
Search instead for 
Did you mean: 

Cleaning Records with script logic QUESTION

former_member182305
Active Participant
0 Kudos
183

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member

" 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.

former_member186338
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

former_member186338
Active Contributor
0 Kudos

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.

former_member182305
Active Participant
0 Kudos

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.

former_member186338
Active Contributor
0 Kudos

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!

former_member186338
Active Contributor
0 Kudos

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!