Skip to Content

Cleaning Records with script logic QUESTION

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    May 01, 2017 at 06:14 AM

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

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 08, 2017 at 04:08 PM

    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!

    Add comment
    10|10000 characters needed characters exceeded