ISLEAF Function for TI

Post Reply
Kingsley
Posts: 21
Joined: Tue Sep 10, 2013 3:34 pm
OLAP Product: TM1
Version: PA 2.0
Excel Version: 2016

ISLEAF Function for TI

Post by Kingsley »

Is there a function for TI equivalent to the ISLEAF rule function?
If I needed to check in the Metadata/Data tab whether the referenced cell is a leaf level cell or not, is there a more pratical way than:

Code: Select all

IF((ELLEV('Dim1',vDim1) = 0) & (ELLEV('Dim2',vDim2) = 0) & (ELLEV('Dim3',vDim3) = 0));
?
Last edited by Kingsley on Fri Dec 13, 2013 5:57 pm, edited 1 time in total.
User avatar
jim wood
Site Admin
Posts: 3952
Joined: Wed May 14, 2008 1:51 pm
OLAP Product: TM1
Version: PA 2.0.7
Excel Version: Office 365
Location: 37 East 18th Street New York
Contact:

Re: ISLEAF Function for TI

Post by jim wood »

What does your data source look like to have to try to do dim1, then dim2 etc... ElLev however is normally the weapon of choice, it's just a case of how you deploy it.
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
Kingsley
Posts: 21
Joined: Tue Sep 10, 2013 3:34 pm
OLAP Product: TM1
Version: PA 2.0
Excel Version: 2016

Re: ISLEAF Function for TI

Post by Kingsley »

The datasource is a text file export of a cube. Error occurs on non-leaf cells when trying to input the data back into the cube via CellPutN().

Using ELLEV seems to be faster than CellIsUpdateable()
Good to know that this is the way to do it.

Thanks
Wim Gielis
MVP
Posts: 3127
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: ISLEAF Function for TI

Post by Wim Gielis »

Dtype('dimension','element')@='N'

is an alternative to Ellev. Don't know if it's faster or not. I'll leave that one as an exercise to you :-)
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
lotsaram
MVP
Posts: 3666
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: ISLEAF Function for TI

Post by lotsaram »

You could use CellIsUpdateable( Cube, dim1, dim2, ... dimn )
It will return true (=1) if all dimension references are leaf elements, which would be a shortcut to testing ELLEV or DTYPE of all dimensions individually.

But if there is a rule on the cell or locks on any of the elements it will return false. So not quite the same as ISLEAF but might be close enough depending on your situation.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
Wim Gielis
MVP
Posts: 3127
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: ISLEAF Function for TI

Post by Wim Gielis »

In the end, if you want to do a CellPutN (or CellIncrementN, CellPutS, for that matter), you're interested in being able to update the cell or not.
Be it rules-driven cells, consolidated cells, cells with a lock, ... CellIsUpdateable is one possibility.

If it turns out that CellIsUpdateable returns zero for some record(s), you might want to populate an error log (CSV file for example) or use ItemReject (or just ItemSkip).
Part of the ItemReject could be that Ellev > 0 for some field.
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
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: ISLEAF Function for TI

Post by rmackenzie »

Wim Gielis wrote:Dtype('dimension','element')@='N'

is an alternative to Ellev. Don't know if it's faster or not. I'll leave that one as an exercise to you :-)
DTYPE is preferred to ELLEV for the purposes of the OP - a consolidated element with no children will return an ELLEV=0 but also should mean CellIsUpdateable is 0. However, its DTYPE is C as opposed to N. E.g.

Code: Select all

IF ( DTYPE ( 'Dim1', 'Elem1' ) @= 'N' & DTYPE ( 'Dim2', 'Elem2' ) @= 'N' ... etc)
Robin Mackenzie
User avatar
Michel Zijlema
Site Admin
Posts: 712
Joined: Wed May 14, 2008 5:22 am
OLAP Product: TM1, PALO
Version: both 2.5 and higher
Excel Version: 2003-2007-2010
Location: Netherlands
Contact:

Re: ISLEAF Function for TI

Post by Michel Zijlema »

Kingsley wrote:The datasource is a text file export of a cube. Error occurs on non-leaf cells when trying to input the data back into the cube via CellPutN().
Was there a reason to include the consolidated cells in the file export? When there are no consolidated cell values in the export you wouldnt need to bother about celltypes.

Michel
User avatar
jim wood
Site Admin
Posts: 3952
Joined: Wed May 14, 2008 1:51 pm
OLAP Product: TM1
Version: PA 2.0.7
Excel Version: Office 365
Location: 37 East 18th Street New York
Contact:

Re: ISLEAF Function for TI

Post by jim wood »

Michel Zijlema wrote:
Kingsley wrote:The datasource is a text file export of a cube. Error occurs on non-leaf cells when trying to input the data back into the cube via CellPutN().
Was there a reason to include the consolidated cells in the file export? When there are no consolidated cell values in the export you wouldnt need to bother about celltypes.

Michel
A very good point. Even if you don't dimension parity you can still make sure no consolidations exist in the dimensions that you're directly mapping. Saying that, we don't know if it's an export from a TM1 cube. The cube may be somewhere else, like EP or Essbase. Although the same principal should still apply.
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
Wim Gielis
MVP
Posts: 3127
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: ISLEAF Function for TI

Post by Wim Gielis »

rmackenzie wrote:DTYPE is preferred to ELLEV for the purposes
I agree.
rmackenzie wrote:a consolidated element with no children will return an ELLEV=0
I don't agree. I am using version 10.2 and it returns 1.
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
lotsaram
MVP
Posts: 3666
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: ISLEAF Function for TI

Post by lotsaram »

That must be new with 10.2 or maybe 10.1
Certainly always used to be the case that an orphan C element returned 0 for the level. It's both good that they've fixed this yet somehow also not quite logical.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
Wim Gielis
MVP
Posts: 3127
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: ISLEAF Function for TI

Post by Wim Gielis »

It was my belief as well, that it returned 0. That's why I mentioned the difference in (at least) 10.2 :-)
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
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: ISLEAF Function for TI

Post by rmackenzie »

Wim, thanks for the update. That's a little surprising that that change got implemented... I am also wondering if it is totally logical...
Robin Mackenzie
Duncan P
MVP
Posts: 600
Joined: Wed Aug 17, 2011 1:19 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2
Excel Version: 2003 2007
Location: York, UK

Re: ISLEAF Function for TI

Post by Duncan P »

ELLEV returns 1 for an empty C in 9.5.2 as well. Which version have you seen it return 0 in?

I would have thought that 1 is more sensible, particularly if you are using filter by level to select leaves. As in "It's got no children, but all of them are leaves."

[EDIT] Oh and BTW it returns 1 in 9.0 SP3 as well. Perhaps it was a temporary thing in 9.1 or 9.4 that someone complained about.
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: ISLEAF Function for TI

Post by rmackenzie »

Duncan P wrote:[EDIT] Oh and BTW it returns 1 in 9.0 SP3 as well. Perhaps it was a temporary thing in 9.1 or 9.4 that someone complained about.
It happened on a number of occasions but unfortunately I can't recall which versions - all probably 9.x. Notably it cropped up in this sort of statement:

Code: Select all

{TM1FILTERBYLEVEL({TM1SUBSETALL([Some_dimension])}, 0)}
as well as with the ELLEV function.

I got used to using DTYPE to isolate n-level leaves and had assumed that the empty parents being at level 0 was by design and not in error, as now seems the case with the anomalous return values we're talking about.
Robin Mackenzie
Wim Gielis
MVP
Posts: 3127
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: ISLEAF Function for TI

Post by Wim Gielis »

For me as well, there have been version(s) where the result was 0 for the ellev, certainly 9.x version(s), perhaps around 9.4 a couple of years ago.
Sorry I can't be that precise anymore :-) Time flies when you're having fun ;-)
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