Hi - I know the below code is not a good practice but is there is an alternative way to set the data =0 because I want to clear all Origin Base member and UD2 base. Any help would be appreciated ?
...
I am still not 100% sure what you are trying to achieve here. When you want to copy data from account A to B, account B is a calculated account, I assume? That is why I asked if the data you wish to clear is calculated.
With regards to your script, you are looping within a loop, which I would not recommend as this will have an impact on performance.
I will assume that there is calculated data on the target account that is being calculated during each calculation. Ideally, data is not copied to an account where it has to be deleted later on. If that cannot be avoided one may clear it afterwards, of course. In that case, (something like) these two rows may be all you need.
1. When Account B has data then Copy the Data from B to A USD and A Local should not be cleared. 2. If the B has no data, then A should translate naturally.
Hi Kris, so you are attempting a standard translation override. Typically one uses the flow dimension for this, but I assume using an account to hold the override data is the result of the design session. There are - as always - several ways to go about it. Here is a simple example:
If (Not api.Entity.HasChildren() And api.Cons.IsForeignCurrencyForEntity) Then 'Execute on local entity and C#Ttranslated
If not api.Data.GetDataCell("A#B").CellStatus.IsNoData Then 'If B has data, clear A on Translated and copy from B
api.Data.ClearCalculatedData(False, True, False, "A#A") 'Set only Clear Translated Data to TRUE api.Data.Calculate("A#A = A#B") 'Copy translation overrides from B to A