Musings on CellGetN vs DB(...) performance in rules
- garry cook
- Community Contributor
- Posts: 209
- Joined: Thu May 22, 2008 7:45 am
- OLAP Product: TM1
- Version: Various
- Excel Version: Various
Musings on CellGetN vs DB(...) performance in rules
So I had a blonde moment and coded a rule file in 10.2.2 SP2 with a CellGetN rather than DB as follows -
['Orig Val',{'EUR input','GBP input'},'2015']=N:
IF(CellGetN('z Control by Version','Most Likely Outcome','Current Month','Numeric')<ATTRN('Months', !Months, 'IndexN'),
blah);
which compiles fine, works properly and goes through the rule tracer properly, etc. Syntax error showed up when copying back to a 10.2 server and I realised that I've TI syntax'd rather than rule syntax so had to change it to the compilable correct syntax -
['Orig Val',{'EUR input','GBP input'},'2015']=N:
IF(DB('z Control by Version','Most Likely Outcome','Current Month','Numeric')<ATTRN('Months', !Months, 'IndexN'),
blah);
Have to be honest, I wasn't aware that they'd standardised the functions so came as somewhat of a surprise although to be fair I got bored reading the patch notes. Just wondering if anyone has tested this to see if there is any appreciable performance difference between the two syntax or if they had seen issues using CellGetN in rules.
Would be useful to do training for developers to have one standard function between both Rules and TI so just musing on if this is stable. Couldn't find it on a forum search so apologies if I've missed a thread.
TIA
['Orig Val',{'EUR input','GBP input'},'2015']=N:
IF(CellGetN('z Control by Version','Most Likely Outcome','Current Month','Numeric')<ATTRN('Months', !Months, 'IndexN'),
blah);
which compiles fine, works properly and goes through the rule tracer properly, etc. Syntax error showed up when copying back to a 10.2 server and I realised that I've TI syntax'd rather than rule syntax so had to change it to the compilable correct syntax -
['Orig Val',{'EUR input','GBP input'},'2015']=N:
IF(DB('z Control by Version','Most Likely Outcome','Current Month','Numeric')<ATTRN('Months', !Months, 'IndexN'),
blah);
Have to be honest, I wasn't aware that they'd standardised the functions so came as somewhat of a surprise although to be fair I got bored reading the patch notes. Just wondering if anyone has tested this to see if there is any appreciable performance difference between the two syntax or if they had seen issues using CellGetN in rules.
Would be useful to do training for developers to have one standard function between both Rules and TI so just musing on if this is stable. Couldn't find it on a forum search so apologies if I've missed a thread.
TIA
-
- Site Admin
- Posts: 1454
- Joined: Wed May 28, 2008 9:09 am
Re: Musings on CellGetN vs DB(...) performance in rules
I've seen nothing announced. Since the functions do the same job, and you have been able to do the opposite for a number of versions (ie use DB in TI), I think it's an unintended side effect etc.
-
- MVP
- Posts: 3654
- Joined: Fri Mar 13, 2009 11:14 am
- OLAP Product: TableManager1
- Version: PA 2.0.x
- Excel Version: Office 365
- Location: Switzerland
Re: Musings on CellGetN vs DB(...) performance in rules
Never knew that. Since DB() is ambidextrous when it comes to string vs. numeric data what does the TI editor do when you initialize a variable with DB() on the RHS?David Usherwood wrote:I've seen nothing announced. Since the functions do the same job, and you have been able to do the opposite for a number of versions (ie use DB in TI), I think it's an unintended side effect etc.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
-
- MVP
- Posts: 3120
- 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: Musings on CellGetN vs DB(...) performance in rules
Hello David,David Usherwood wrote:I've seen nothing announced. Since the functions do the same job, and you have been able to do the opposite for a number of versions (ie use DB in TI), I think it's an unintended side effect etc.
I cannot make it working in a simple TI process without data source.
This works fine (obviously):
Code: Select all
Ascii0utput( 'test.txt', NumberToString(CellGetN('Posts', 'Year 2014', 'Excel related', 'Number of posts')));
Code: Select all
Ascii0utput( 'test.txt', NumberToString(DB('Posts', 'Year 2014', 'Excel related', 'Number of posts')));
Can you please provide more details?
Tested with TM1 10.2.2, last but one FP.
Thanks !
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
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
-
- Site Admin
- Posts: 1454
- Joined: Wed May 28, 2008 9:09 am
Re: Musings on CellGetN vs DB(...) performance in rules
Seems like a senior moment....
Possibly it was supported in earlier versions but I'm not planning to excavate until I find the right version.
(From 10.2.2)DB
DB returns a value from a cube in a TM1® database. DB returns a numeric value if used in a numeric expression and a string value if used in a string expression.
This is a TM1 rules function, valid in TM1 rules only. Use of this function in a TurboIntegrator process will cause an error.
Possibly it was supported in earlier versions but I'm not planning to excavate until I find the right version.
-
- MVP
- Posts: 3120
- 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: Musings on CellGetN vs DB(...) performance in rules
Me neitherDavid Usherwood wrote:Possibly it was supported in earlier versions but I'm not planning to excavate until I find the right version.
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
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
- Alan Kirk
- Site Admin
- Posts: 6606
- Joined: Sun May 11, 2008 2:30 am
- OLAP Product: TM1
- Version: PA2.0.9.18 Classic NO PAW!
- Excel Version: 2013 and Office 365
- Location: Sydney, Australia
- Contact:
Re: Musings on CellGetN vs DB(...) performance in rules
It does?? 'Cos when I copied that to paste it into my TI I found that the 0 in AsciiOutput was a zero instead of a letter O! (Yes, I know only too well the perils of air code myself, so I say this merely in jest, I assure you.)Wim Gielis wrote: This works fine (obviously):
Code: Select all
Ascii0utput( 'test.txt', NumberToString(CellGetN('Posts', 'Year 2014', 'Excel related', 'Number of posts')));
I think you guys will be looking back a fair way. My operational version is 9.5.2, and it didn't work there. However I also still have a VM which was used as a testbed for our old production version of 9.0 SP3... and it threw the same error. So if it actually worked and Garry wasn't just having a bad dream, it sounds like it was a glitch that was specific to a particular service pack. Either that or it's something from way back in version 8-land, but Garry indicated that it was fresh code rather than something that was dug out of an ancient boneyard.Wim Gielis wrote:Me neitherDavid Usherwood wrote:Possibly it was supported in earlier versions but I'm not planning to excavate until I find the right version.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
-
- MVP
- Posts: 3120
- 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: Musings on CellGetN vs DB(...) performance in rules
No, it doesn't work like that because of the 0Alan Kirk wrote:It does?? 'Cos when I copied that to paste it into my TI I found that the 0 in AsciiOutput was a zero instead of a letter O! (Yes, I know only too well the perils of air code myself, so I say this merely in jest, I assure you.)Wim Gielis wrote: This works fine (obviously):
Code: Select all
Ascii0utput( 'test.txt', NumberToString(CellGetN('Posts', 'Year 2014', 'Excel related', 'Number of posts')));
I was making sure I had CamelCase function names in my posted code, and I must have done a bad typ0
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
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
- garry cook
- Community Contributor
- Posts: 209
- Joined: Thu May 22, 2008 7:45 am
- OLAP Product: TM1
- Version: Various
- Excel Version: Various
Re: Musings on CellGetN vs DB(...) performance in rules
It's fresh code in 10.2.2 SP2 but it's the other way round I'd noticed - CellGetN working in Rules rather than DB working in TI which was news to me. Wouldn't compile in 10.2.0 which is when I realised I'd coded the wrong way round. Pretty sure it didn't allow DB in TI in version 8.1.8 (or indeed 7.1.4) as I remember being really annoyed that two different syntax was required for the same function but that was a loooong time ago so memory is fuzzy on that.So if it actually worked and Garry wasn't just having a bad dream, it sounds like it was a glitch that was specific to a particular service pack. Either that or it's something from way back in version 8-land, but Garry indicated that it was fresh code rather than something that was dug out of an ancient boneyard.
And the only bad dream I seem to be unable to wake from was the Scottish Independence vote