Gah! Inconsistant QuDefine behaviour

Post Reply
User avatar
Steve Rowe
Site Admin
Posts: 2455
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: TM1 v6,v7,v8,v9,v10,v11+PAW
Excel Version: Nearly all of them

Gah! Inconsistant QuDefine behaviour

Post by Steve Rowe »

Sigh...
I've spent a while now writing some report building VBA that is based around the use of QUDefine. It's for use in the French office version, 64 bit 9.0 SP3 U9 server that I look after.
I built it on my laptop though for practical reasons. This is a UK office version, 32 bit 9.0 SP3 U9.

Guess what!
The stuff that I have built locally does not work in my live environment. With a copy of the dev server running in the live 64 bit environment the Qudefine statement that returns a true result in my local environment returns “Erreur 2015” in the French 64 bit environment.

I’m thinking there are 3 options as to the problem.
1. User error…
2. Differences in the French VBA environment to the English one.
3. Differences between the 63 bit and 32 bit versions of the software.

I’m pretty sure that I have done my testing in such a way that eliminates any possibility of option 1. Has anyone had any experience of option 2 or 3? Any other options that you might like to add? Anyone have further information in “Erreur 2015”, is it a straight VBA error or TM1?

I hate wasting time like this… gah! :evil:

Truncated code

Code: Select all

Option Explicit
Dim rngQuery As Range, ans As Variant, rngCol As Range, rngRowe As Range
Dim wksQuery As Worksheet, wksSA1 As Worksheet, server As String, cube As String, wksActive As Worksheet


Const QueryName = "zSA1query"


Sub Forum()


Dim ixSheet As Integer, rngCounter As Range, c As Range, rngEntity As Range

Set wksQuery = ThisWorkbook.Worksheets("Query Defn")
Set wksSA1 = ThisWorkbook.Worksheets("SA1")

server = wksQuery.Range("server")
cube = server & wksQuery.Range("Cube")

Set rngQuery = wksQuery.Range("QueryRange")
Set rngCol = wksSA1.Range("colValues")
Set rngRowe = wksSA1.Range("rowValues")
Set rngCounter = wksQuery.Range("Counter")
Set rngEntity = wksQuery.Range("Entity")

    'update query
    
    wksQuery.Calculate
    
    ans = Application.Run("Qudefine", cube, QueryName, rngQuery, "", "", "true", "false")
    'ans returns true on test system and Erreur 2015 on live system
    
    ans = Application.Run("QUSUBSET", cube, QueryName, "Management Information", QueryName)
    ans = Application.Run("QUSUBSET", cube, QueryName, "Sub-analysis 1", QueryName)


End Sub
Technical Director
www.infocat.co.uk
Andy Key
MVP
Posts: 352
Joined: Wed May 14, 2008 1:37 pm
OLAP Product: TM1
Version: 2.5 to PA
Excel Version: Lots
Location: Sydney
Contact:

Re: Gah! Inconsistant QuDefine behaviour

Post by Andy Key »

Can you run any Application.Run() commands when written in English and executed in French?
Andy Key
User avatar
Steve Rowe
Site Admin
Posts: 2455
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: TM1 v6,v7,v8,v9,v10,v11+PAW
Excel Version: Nearly all of them

Re: Gah! Inconsistant QuDefine behaviour

Post by Steve Rowe »

Good try, somthing I had not thought of, but a DBRW in application.run form works.
cheers,
Technical Director
www.infocat.co.uk
User avatar
Steve Rowe
Site Admin
Posts: 2455
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: TM1 v6,v7,v8,v9,v10,v11+PAW
Excel Version: Nearly all of them

Re: Gah! Inconsistant QuDefine behaviour

Post by Steve Rowe »

Just to update on this, I'm pretty sure the issue is nothing to do with QuDefine. I've just noticed that VBA seems to be ignoring change or skipping over particular lines of code.

It's very odd... As I step through the code a particular line will get ignored totally. It seems to be particularly bad on lines that I have just editted, sometimes even remembering the value that would have been assigned to a variable before the edit I had made.

This is preserved through restart of the excel session is happening on multiple different bits of VBA code. Obviously coding gets pretty hard if you can't rely on all your lines of script being executed.

Forcing a compile does not effect the issue either.

Other than needing to re-install office does anyone know if there is an option or smoething that might cause VBA to behave like this? It seems like the script is not getting compiled everytime the script is being run.

Excel 20003 SP2 ; Microsoft visual basic 6.3 (Retail 6.49972)
Cheers,
Technical Director
www.infocat.co.uk
Andy Key
MVP
Posts: 352
Joined: Wed May 14, 2008 1:37 pm
OLAP Product: TM1
Version: 2.5 to PA
Excel Version: Lots
Location: Sydney
Contact:

Re: Gah! Inconsistant QuDefine behaviour

Post by Andy Key »

Excel 20003 SP2
I reckon it's because you are using a version of Excel that isn't due for release for another 17,994 years...
Andy Key
mitch23
Posts: 21
Joined: Thu Jan 29, 2009 11:32 am
OLAP Product: Planning Analytics
Version: 10.1
Excel Version: Office 365

Re: Gah! Inconsistant QuDefine behaviour

Post by mitch23 »

I have recently had exactly the same problem with QUDEFINE. It seemed as if the line of code was simply being ignored. Complete restart of Excel did not fix the issue. Then a couple of days later it magincally started working again. Go figure.
User avatar
Steve Rowe
Site Admin
Posts: 2455
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: TM1 v6,v7,v8,v9,v10,v11+PAW
Excel Version: Nearly all of them

Re: Gah! Inconsistant QuDefine behaviour

Post by Steve Rowe »

Mitch,
What version of VBA were using for interests sake?
Cheers,
Technical Director
www.infocat.co.uk
mitch23
Posts: 21
Joined: Thu Jan 29, 2009 11:32 am
OLAP Product: Planning Analytics
Version: 10.1
Excel Version: Office 365

Re: Gah! Inconsistant QuDefine behaviour

Post by mitch23 »

6.5
mitch23
Posts: 21
Joined: Thu Jan 29, 2009 11:32 am
OLAP Product: Planning Analytics
Version: 10.1
Excel Version: Office 365

Re: Gah! Inconsistant QuDefine behaviour

Post by mitch23 »

I think I just figured this out. It is not a VBA issue. If any of the elements are invalid, the function will fail silently and act like it just didn't execute. You can trap this by capturing the bollean return value into a variable. Returns true is successfully created the view and false if not.
Post Reply