This should be a simple one. The following is not returning a positive number. I am being blind to something?
sExisting_Rule = CubeRuleGet('INP Capital Planning');
nTargetCommaPosition = scan(sExisting_Rule,char(39)) ;
asciioutput('Test_Scan_Rule_File.csv',numbertostring(nTargetCommaPosition) );
nTargetCommaPosition is returning 0.
I have checked:
1) that the full rule string is being referenced
2) that the ' characters in the rule file are Ascii code 39 as you would expect
Scan of rules not returning what I am expecting
-
- MVP
- Posts: 352
- Joined: Wed May 14, 2008 1:37 pm
- OLAP Product: TM1
- Version: 2.5 to PA
- Excel Version: Lots
- Location: Sydney
- Contact:
Re: Scan of rules not returning what I am expecting
Switch the order of your Scan parameters. You're currently looking for the text of the existing rule inside a string that only contains an apostrophe.
Andy Key
- Steve Rowe
- Site Admin
- Posts: 2455
- Joined: Wed May 14, 2008 4:25 pm
- OLAP Product: TM1
- Version: TM1 v6,v7,v8,v9,v10,v11+PAW
- Excel Version: Nearly all of them
Re: Scan of rules not returning what I am expecting
scribe, subscribe !
Technical Director
www.infocat.co.uk
www.infocat.co.uk
-
- Posts: 117
- Joined: Mon Jul 29, 2019 5:02 am
- OLAP Product: Planning Analytics
- Version: 2.0.9.x
- Excel Version: Office 365 16
Re: Scan of rules not returning what I am expecting
? Too cryptic for me.
- gtonkin
- MVP
- Posts: 1254
- Joined: Thu May 06, 2010 3:03 pm
- OLAP Product: TM1
- Version: Latest and greatest
- Excel Version: Office 365 64-bit
- Location: JHB, South Africa
- Contact:
Re: Scan of rules not returning what I am expecting
My cheat sheet just has it as: Scan(substring, string)
And don't forget that it is case sensitive.
Or maybe try remember something like "submarine"
Scan('sub', 'submarine');
A different take on Steve's approach but maybe his example would have worked better with 'sub' as the substring instead of 'scribe'
And don't forget that it is case sensitive.
Or maybe try remember something like "submarine"
Scan('sub', 'submarine');
A different take on Steve's approach but maybe his example would have worked better with 'sub' as the substring instead of 'scribe'
-
- MVP
- Posts: 3222
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.1.5
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Scan of rules not returning what I am expecting
I have more problems with INSRT and FILL. To name just a few. Luckily PAW helps us.
Best regards,
Wim Gielis
IBM Champion 2024-2025
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
Wim Gielis
IBM Champion 2024-2025
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
-
- Regular Participant
- Posts: 432
- Joined: Sat Jun 08, 2019 9:55 am
- OLAP Product: Planning Analytics
- Version: Planning Analytics 2.0
- Excel Version: Excel 2016
Re: Scan of rules not returning what I am expecting
I must admit that I always think scan means the whole word, so I would expect the full string to be the first argument. I.e. I am scanning this to see if I can find that.
That said, the fact checking the order was missing from this is a bit of an oversight
That said, the fact checking the order was missing from this is a bit of an oversight

Maren1) that the full rule string is being referenced
2) that the ' characters in the rule file are Ascii code 39 as you would expect
- Steve Rowe
- Site Admin
- Posts: 2455
- Joined: Wed May 14, 2008 4:25 pm
- OLAP Product: TM1
- Version: TM1 v6,v7,v8,v9,v10,v11+PAW
- Excel Version: Nearly all of them
Re: Scan of rules not returning what I am expecting
Pretty sure this was the example quoted in the help document at one time, just stuck in my brain....
Technical Director
www.infocat.co.uk
www.infocat.co.uk