DBRW Formula being overwritten
Posted: Mon Oct 11, 2010 8:55 am
Folks
We have the scenario that when a user types into a DBRW it overwrites the formula and thus does not send data back to TM1.
I assume that the TM1P.XLA works in the following manner.
An event handler is set up on the worksheet_change event. This is my attempt at some pseudo code.
My excel is not good enough to determine whether the Worksheet_Change event gives you the before and after cell value (which you would expect) or whether only the range of changed cells is given and tm1p.xla has to maintain a table of DBRW formulae of its own. In either case I have referred to the
structure as Target.OldValue in the code.
As can be seen there is a great deal being done in the event handler and without access to TM1P.xla this is a black box. (It might be an idea to allow read only access to the code IBM in the future).
Clearly what has happened in the case where the DBRW is being overwritten is that the event handler is disabled not working in some way.
Any ideas as to why this might be the case would be appreciated.
Best Regards
John
We have the scenario that when a user types into a DBRW it overwrites the formula and thus does not send data back to TM1.
I assume that the TM1P.XLA works in the following manner.
An event handler is set up on the worksheet_change event. This is my attempt at some pseudo code.
Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
'Do nothing if more than one cell is changed or content deleted
If Target.Address = in range of DBRWs or Target.OldValue begins with DBRW Then
'Stop any possible runtime errors and halting code
On Error Resume Next
'Turn off ALL events
Application.EnableEvents = False
Call .dll to communicate with TM1 using value = Target.Address and dimensions based on the DBRW formula contained within the Target.oldvalue. This would call an update function.
If (return is bad)
Place *KEY_ERROR into the return value for the DBRW function and Copy the formula back Target.Address = Target.OldValue
Else
Copy the formula back Target.Address = Target.OldValue and allow the formula to display the updated value.
Endif
'Turn events back on
Application.EnableEvents = True
'Allow run time errors again
On Error GoTo 0
End If
End If
End Sub
structure as Target.OldValue in the code.
As can be seen there is a great deal being done in the event handler and without access to TM1P.xla this is a black box. (It might be an idea to allow read only access to the code IBM in the future).
Clearly what has happened in the case where the DBRW is being overwritten is that the event handler is disabled not working in some way.
Any ideas as to why this might be the case would be appreciated.
Best Regards
John