Page 1 of 1

Issue with LogOutput and/or certain hierarchy subset functions

Posted: Sat Feb 29, 2020 5:33 pm
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

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

Posted: Mon Mar 02, 2020 10:49 am
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.

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

Posted: Tue Mar 03, 2020 2:42 pm
by Wim Gielis
Thank you Kamil. I will do some more testing when time is available.

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

Posted: Thu Mar 05, 2020 1:12 pm
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