Page 1 of 1

How to check for the presence of the element in the subset?

Posted: Thu Dec 25, 2014 2:00 pm
by bogdan
Hello, How to check for the presence of the element in the subset?
Thanks.

Re: How to check for the presence of the element in the subs

Posted: Thu Dec 25, 2014 6:33 pm
by tm1_bloke
Well, you didn't specify your need so:
1. Visually in subset editor :)
2. Write a while loop in TI process to loop thru subset indexes from 1..n where n=SubsetGetSize(<subset_name>) and check with IF condition and SubsetGetElementName function if the element equals to the element you are looking for and store the result of comparison in a variable for later use. There is no ready made function available for your need. Also, note that an element can exist multiple times in subset so an additional counter to indicate the number of occurences in while loop could be useful (?).

May I ask what's your use case where you need this information?

Re: How to check for the presence of the element in the subs

Posted: Thu Dec 25, 2014 9:32 pm
by Alan Kirk
tm1_bloke wrote:Well, you didn't specify your need
Quite so. I thought that the Request For Assistance Guidelines were pretty clear on this point.
RFA Guidelines wrote:2) Ensure that you specify the component of the software that you're having a problem with. If someone states that they have a problem with number formatting, people need to know whether that's in Cube Viewer, Web, EV, the API, or wherever.

3) Try to make the question as specific as possible. A general question like "How do I write a rule?" is difficult to answer without copying out the whole of the user manual. A question like "I have a payroll cube which contains the following dimensions {details} and a general ledger cube which contains the following dimensions {details}, and although I've read through the Rules Guide I'm still not sure how to write a rule to give me average sales per employee" is far more likely to get the answer your need.
tm1_bloke wrote:1. Visually in subset editor :)
Heh, heh... cruel but fair, that one.
tm1_bloke wrote:2. Write a while loop in TI process to loop thru subset indexes from 1..n where n=SubsetGetSize(<subset_name>) and check with IF condition and SubsetGetElementName function if the element equals to the element you are looking for and store the result of comparison in a variable for later use.
Yup, and that's exactly why those guidelines are there. If the existence was being checked in Excel / VBA rather than TI it would be necessary to use SubSiz and SubNm respectively instead. Failing to provide full details of a question just wastes everyone's time because all they can do is guess at what the context is.
tm1_bloke wrote:There is no ready made function available for your need.
Unfortunately. It has been raised before of course. It's currently sitting equal second on the DeveloperWorks request for enhancement list with 7 votes, one behind the AsciiAppend function.I do encourage anyone with a DeveloperWorks account to get in and support the request (63581) by votes and comments if you want to see IBM pay some attention to it.

Re: How to check for the presence of the element in the subs

Posted: Wed Dec 31, 2014 10:32 am
by BariAbdul
Hi bogdan,I don't know how much it would help but worth to go through :) :
http://www.tm1forum.com/viewtopic.php?f ... 1840#p1840