Issue with LogOutput and/or certain hierarchy subset functions

Post Reply
Wim Gielis
MVP
Posts: 3120
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Issue with LogOutput and/or certain hierarchy subset functions

Post by Wim Gielis »

Hello,

I have this code, which generates weird output. Can someone make any sense out of it ? I would expect simple concatenations of text and a number (converted to text).

Code: Select all

LogOutput( 'INFO', 'z' | numbertostring( HierarchySubsetExists( 'Rp_Company', 'Rp_Company', 'beperking Rp' ) ) );
LogOutput( 'INFO', 'y' | numbertostring( SubsetExists( 'Rp_Company:Rp_Company', 'beperking Rp' ) ) );

LogOutput( 'ERROR', 'pp' | numbertostring( HierarchySubsetExists( 'Rp_Company', 'Rp_Company', 'beperking Rp' ) ) );

AsciiOutput( 'ERROR.txt' ,'pp' | numbertostring( HierarchySubsetExists( 'Rp_Company', 'Rp_Company', 'beperking Rp' ) ) );
The output is as follows:
20960 [4] DEBUG 2020-02-29 18:25:10.970 TM1.TILogOutput Rp_Company1
20960 [4] INFO 2020-02-29 18:25:10.970 TM1.TILogOutput y1
20960 [4] DEBUG 2020-02-29 18:25:10.970 TM1.TILogOutput Rp_Company1
The last line gives me a text file called pp.cma ! (shouldn't it be ERROR.txt ?)
The contents are:
"Rp_Company1"
Am I missing something ? Only SubsetExists gives me the correct output.

TM1 2.0.8 currently. I am using Architect. I created a subset as we would always do, in the Subset Editor in Architect. Should I need to use PAW for this to work ?

Thanks,

Wim
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
User avatar
qml
MVP
Posts: 1094
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: Issue with LogOutput and/or certain hierarchy subset functions

Post by qml »

It looks like the first argument of the functions LogOutput/AsciiOutput is being ignored/skipped if you nest HierarchySubsetExists inside. And on further inspection it looks like HierarchySubsetExists returns two values rather than one: the hierarchy name as a string and a numeric flag. Because it returns two values, the functions in which HierarchySusbsetExists is nested get out of whack with all arguments moved by one position.

What happens if you assign the return value of HierarchySusbsetExists to a variable first? Do you just get the numeric flag or do you get the string bit?

In either case, this is a bug. TI functions should never return multiple values.
Kamil Arendt
Wim Gielis
MVP
Posts: 3120
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Issue with LogOutput and/or certain hierarchy subset functions

Post by Wim Gielis »

Thank you Kamil. I will do some more testing when time is available.
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
MVP
Posts: 3120
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Issue with LogOutput and/or certain hierarchy subset functions

Post by Wim Gielis »

qml wrote: Mon Mar 02, 2020 10:49 am What happens if you assign the return value of HierarchySusbsetExists to a variable first? Do you just get the numeric flag or do you get the string bit?
If you use a variable for HierarchySubsetExists first, it works as expected. This:

Code: Select all

v = HierarchySubsetExists( 'Rp_Company', 'Rp_Company', 'beperking Rp' );

LogOutput( 'INFO', 'z' | numbertostring( v ) );
gives: z1
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Post Reply