Scan of rules not returning what I am expecting

Post Reply
JohnO
Posts: 117
Joined: Mon Jul 29, 2019 5:02 am
OLAP Product: Planning Analytics
Version: 2.0.9.x
Excel Version: Office 365 16

Scan of rules not returning what I am expecting

Post by JohnO »

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
Andy Key
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

Post by Andy Key »

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
JohnO
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

Post by JohnO »

Andy Key wrote: Tue Sep 17, 2024 2:58 am 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.
How obvious.

Thank you.
User avatar
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

Post by Steve Rowe »

scribe, subscribe !
Technical Director
www.infocat.co.uk
JohnO
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

Post by JohnO »

Steve Rowe wrote: Wed Sep 18, 2024 1:30 pm scribe, subscribe !
? Too cryptic for me.
User avatar
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

Post by gtonkin »

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'
BR, George.

Learn something new: MDX Views
Wim Gielis
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

Post by Wim Gielis »

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
MarenC
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

Post by MarenC »

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 :oops:
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
Maren
User avatar
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

Post by Steve Rowe »

Steve Rowe wrote: Wed Sep 18, 2024 1:30 pm scribe, subscribe !
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
Post Reply