Page 1 of 1
writing a rule for 70+ elements that all start with XX...
Posted: Tue Sep 22, 2009 7:36 pm
by kbogies
Hi all,
I'm trying to write some ratio rules in the Server Explorer and there's a pretty big IF; if elements [start with X....] then... Is there a rule that i can write for "starts with"? I'd really prefer not to write 72 individual rules for all the multi-level decendants (which all start with X).
Thanks!
Re: writing a rule for 70+ elements that all start with XX...
Posted: Tue Sep 22, 2009 8:53 pm
by Martin Ryan
Try "subst"
E.g. if(subst(!Elem, 1, 2)@='xx', true, false).
Martin
Re: writing a rule for 70+ elements that all start with XX...
Posted: Tue Sep 22, 2009 10:17 pm
by lotsaram
2c
Functions like SUBST and SCAN can be very expensive in terms of calculation efficiency. I would approach this by setting an attribute for the elements based on the starting string and basing the rule off a simple attribute lookup rather than a string function.
Re: writing a rule for 70+ elements that all start with XX...
Posted: Fri Oct 09, 2009 5:53 pm
by kbogies
just to follow up... i used an attribute on all 70+ elements to use for a lookup in a reference cube. seems to work pretty smoothly.
Thanks!
Re: writing a rule for 70+ elements that all start with XX...
Posted: Fri Oct 09, 2009 7:34 pm
by wissew
kbogies wrote:just to follow up... i used an attribute on all 70+ elements to use for a lookup in a reference cube. seems to work pretty smoothly.
Thanks!
Correct, attributes are the way to go!