scan/substring

Post Reply
samiamsz
Posts: 18
Joined: Wed Sep 02, 2020 3:08 pm
OLAP Product: tm1
Version: 11.3. 0.
Excel Version: 16

scan/substring

Post by samiamsz »

Hey guys, I am new to coding and even newer to tm1.
I am trying to achieve this in the ti process and i knwo how to in excel
so bascally in excel if i have a list of cells that have "... : ..." and i want all the characters to the right of the ':' character i would do a right and find.
I am having trouble figuring out how to do so in the ti process. I dont need 4 or 5 or any specific amount of characters from the right, i need any amount of characters to the right of the ":"
so what i did was
sSubString = ':'
sScan = scan (sSubString, sStringVariable')
subst (sStringVariablen Long(sStringVariable) - sScan,(Not sure what to put here to get exact characters after the ':' in the string variable )

the string variable contains multiple elements each having a prefix before the ':' character and an unknown amount of characters after

am i approaching this the right way? if no, can someone give me some clarification? thank you
declanr
MVP
Posts: 1815
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: scan/substring

Post by declanr »

Something like below where you work out how many characters are to the right of your character should get you there.
If you start having the possibility for multiple ":" characters you would then need to look at loops to find the further right one perhaps.

Code: Select all

nPosition = Scan ( ':', sString );
sNewString = SubString ( sString, nPosition + 1, Long ( sString ) - nPosition );
Declan Rodger
samiamsz
Posts: 18
Joined: Wed Sep 02, 2020 3:08 pm
OLAP Product: tm1
Version: 11.3. 0.
Excel Version: 16

Re: scan/substring

Post by samiamsz »

thank you
Post Reply