macro to perform a 'page dbrw'

Post Reply
stingo
Posts: 69
Joined: Mon Sep 27, 2010 2:46 pm
OLAP Product: Cognos TM1
Version: 9.1 onwards
Excel Version: client dependant
Location: UK, CH, BE

macro to perform a 'page dbrw'

Post by stingo »

hi,

the question is this,

I want to build a wxcel form without DBRW formulas, and create a macro associated to a button doing something like:

send all data in the range between cell A10 to C20.

Practically I want it to do a serie of DBRWs on all the cells contained in a table (if you know BPC is like the EVDRE command).

Is there someone having some idea in how to do it?
Last edited by stingo on Fri Feb 25, 2011 1:14 pm, edited 1 time in total.
User avatar
qml
MVP
Posts: 1098
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: macro to perform a 'page dbrw'

Post by qml »

There are a number of ways to achieve that, the simplest one not even requiring a macro, just a flag cell and DBS formulas (maybe somewhere in a hidden area. Like that: =IF(FlagCell=1,DBS(...),0). The user would submit data by changing the flag value (manually, using a button, from a dropdown etc) and refreshing the sheet. Or you can use a macro for that (change flag/recalculate/change flag back).
Kamil Arendt
stingo
Posts: 69
Joined: Mon Sep 27, 2010 2:46 pm
OLAP Product: Cognos TM1
Version: 9.1 onwards
Excel Version: client dependant
Location: UK, CH, BE

Re: macro to perform a 'page dbrw'

Post by stingo »

qml wrote:There are a number of ways to achieve that, the simplest one not even requiring a macro, just a flag cell and DBS formulas (maybe somewhere in a hidden area. Like that: =IF(FlagCell=1,DBS(...),0). The user would submit data by changing the flag value (manually, using a button, from a dropdown etc) and refreshing the sheet. Or you can use a macro for that (change flag/recalculate/change flag back).

well, in this case I still have a formula for every cell in my area, I want to avoid it.
David Usherwood
Site Admin
Posts: 1458
Joined: Wed May 28, 2008 9:09 am

Re: macro to perform a 'page dbrw'

Post by David Usherwood »

You can write a macro to work through the data and send it to TM1, on the lines of:

Code: Select all

for each c in range("Send Area")
if c.value <> 0 then
  application.run("DBSW",c.value, <cube>, <dimension refs>)
  endif
  next c
_However_
This approach will send the data to TM1 cell by cell, which will be slower than using DBRWs directly. If you don't have a lot of data the speed loss might not be too painful.
IBM suggest using the VIEW function to ensure the data is handled in one lump. This certainly works for retrieval - I can't recall (and haven't tested) what they said about using it for update. if you do, you can put conditional logic on the View function to ensure it doesn't send when you don't want it.
User avatar
qml
MVP
Posts: 1098
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: macro to perform a 'page dbrw'

Post by qml »

You can also consider creating a TI Process that would be called from your VBA for every data line (or column or cell etc), take the data you want to write to the cube (and all dimension elements too) passed as parameters and the actual writing to the cube can be done by the TI. I have employed this previously with good results (first of all, it's actually a very fast solution). This solution also means that your users do not have to have WRITE access to the cube itself, they just need READ to the TI.
Kamil Arendt
Post Reply