Page 1 of 1

TM1API, TM1ServerLogOpen sFlagFilter parameter

Posted: Sat Jul 27, 2013 12:58 pm
by SirDuke
Hello

I'm trying to process servers log(s) via TM1API. Everything seems to work almost fine. Just can not find a way how to filter log records on element names (like Architect allows to do when you select a particular cube).
I guess this is somehow driven by the last parameter (sFlagFilter) of TM1ServerLogOpen as per documentation excerpt bellow. Just scratching my head what the syntax should be...

Any help would be appreciated

Code: Select all

Declare Function TM1ServerLogOpen
Lib "tm1api.dll"
(ByVal hPool As Long, 
ByVal hServer As Long, 
ByVal rStartTime As
Long, ByVal sCubeFilter As long, 
ByVal sUserFilter As Long, ByVal
sFlagFilter As Long) As Long #<=====!!!!

#sFlagFilter is a long. This TM1 value capsule contains a string used to filter records by flags

Re: TM1API, TM1ServerLogOpen sFlagFilter parameter

Posted: Sat Jul 27, 2013 11:10 pm
by Alan Kirk
SirDuke wrote:Hello

I'm trying to process servers log(s) via TM1API. Everything seems to work almost fine. Just can not find a way how to filter log records on element names (like Architect allows to do when you select a particular cube).
I guess this is somehow driven by the last parameter (sFlagFilter) of TM1ServerLogOpen as per documentation excerpt bellow. Just scratching my head what the syntax should be...

Any help would be appreciated

Code: Select all

Declare Function TM1ServerLogOpen
Lib "tm1api.dll"
(ByVal hPool As Long, 
ByVal hServer As Long, 
ByVal rStartTime As
Long, ByVal sCubeFilter As long, 
ByVal sUserFilter As Long, ByVal
sFlagFilter As Long) As Long #<=====!!!!

#sFlagFilter is a long. This TM1 value capsule contains a string used to filter records by flags
Sorry, I missed this one earlier this morning.

I don't think there is a way for you to do this within the API function itself. As I mentioned in another reply the GUI contains more options than the API function does; note the absence of an EndTime argument in the function above.

I may be wrong and would be happily corrected if I am but I believe that the sFlagFilter is intended only for use when you use the TM1ServerLogSetFlagString API function to add a flag yourself.

To filter by element names you would, I think, need to return the whole records and filter out the ones which don't relate to the element specified. I suspect that the GUI does this in the background. I can't really blame Iboglix for this one; filtering by cube and user within the API function would have been easy since those values are always in the same place on each row. Filtering by element would be a lot harder since every cube will have a different array of dimensions. It would therefore be easier (coding-wise) to apply the element filter(s) after the fact.

On the up side, it does give you the option of doing it better than the GUI does it since you could code it to filter out multiple elements per dimension, not just one.

Re: TM1API, TM1ServerLogOpen sFlagFilter parameter

Posted: Sun Jul 28, 2013 8:24 am
by SirDuke
Thanks Alan
I may be wrong and would be happily corrected if I am but I believe that the sFlagFilter is intended only for use when you use the TM1ServerLogSetFlagString API function to add a flag yourself.
That was also my first thought, which turned out to be incorrect, at least per 9.5.2.

I did a few tests which proved that the sFlagFilter is either completely ignored (likely :evil: ) or must have a very special syntax I'm not aware of.

For sFlagFilter I tried "*", empty string, "foo", <value set from previous call of TM1ServerLogSetFlagString> and in all such cases I got exactly the same set of records. At least I would suspect to get empty set of records for some of the tried value if the filter parameter was really used internally.