0

I would like to know if there is a way to insert condition into substring function in RTF template.

I have this string 18818T12, and would like to truncate it to the number after T

in other word is to print just (12)

I use desktop BI publisher add on words

any help appreciated.

Zee

1 Answer 1

2

Print the substring of 2 characters, starting at the 7th position:

<?xdofx:substr('18818T12',7,2)?>    

Determine the position of the 'T' character, -1 means starting from the back of the string. Add 1 because we want to start at the character following the 'T':

<?xdofx:instr('18818T12','T',-1)+1?>

To determine the length of what we want to print, we need the total length string and we subtract the length of the string up to and including our last 'T' character:

<?xdofx:length('18818T12')-Instr('18818T12','T',-1)?>

Putting all of this together:

<?xdofx:substr('18818T12', Instr('18818T12','T',-1) +1,length('18818T12')-Instr('18818T12','T',-1))?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.