Categories
- All Categories
- 15 Oracle Analytics Sharing Center
- 15 Oracle Analytics Lounge
- 208 Oracle Analytics News
- 41 Oracle Analytics Videos
- 15.7K Oracle Analytics Forums
- 6.1K Oracle Analytics Idea Labs
- Oracle Analytics User Groups
- 76 Oracle Analytics Trainings
- 14 Oracle Analytics Data Visualizations Challenge
- Find Partners
- For Partners
xdo substr funtion with minus position

Summary
xdo substr funtion with minus position
Content
Hi All,
In XML Publisher 4.5.0 is it possible to use substr function with a starting position -4 ?
I'm trying the below:
<?xdofx:substr(‘PT507170490’, -4)?>
Returns the entire string: PT507170490
<?xdofx:substr(‘PT507170490’, 4)?>
Returns: 07170490
Any ideas why and if it's not supported, then do you know a possible workaround?
Regards,
Alex
Answers
-
Hi,
As xdofx is the extended SQL function the above syntax was true.So as of SQL script from dual it's giving proper result below
<span class="kwd" style="font-style: inherit; font-weight: inherit; font-size: inherit; font-family: inherit; color: #101094;">select</span><span class="pln" style="font-style: inherit; font-weight: inherit; font-size: inherit; font-family: inherit; color: #303336;"> substr</span><span class="pun" style="font-style: inherit; font-weight: inherit; font-size: inherit; font-family: inherit; color: #303336;">(</span><span class="str" style="font-style: inherit; font-weight: inherit; font-size: inherit; font-family: inherit; color: #7d2727;">'<span style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;">PT507170490</span>'</span><span class="pun" style="font-style: inherit; font-weight: inherit; font-size: inherit; font-family: inherit; color: #303336;">,</span><span class="lit" style="font-style: inherit; font-weight: inherit; font-size: inherit; font-family: inherit; color: #7d2727;">-9</span><span class="pun" style="font-style: inherit; font-weight: inherit; font-size: inherit; font-family: inherit; color: #303336;">)</span><span class="pln" style="font-style: inherit; font-weight: inherit; font-size: inherit; font-family: inherit; color: #303336;"> </span><span class="kwd" style="font-style: inherit; font-weight: inherit; font-size: inherit; font-family: inherit; color: #101094;">from</span><span class="pln" style="font-style: inherit; font-weight: inherit; font-size: inherit; font-family: inherit; color: #303336;"> dual</span><span class="pun" style="font-style: inherit; font-weight: inherit; font-size: inherit; font-family: inherit; color: #303336;">;</span>
Output as: 507170490
<?xdofx:substr('PT507170490',-9)?>
Output should be similar to the above
<span class="pun" style="font-style: inherit; font-weight: inherit; font-size: inherit; font-family: inherit; color: #303336;"> </span>
0 -
Hi ,
In BI Publisher, substr function always start with 1, you cannot use -ve numbers (please refer the "Extended Function Support in RTF Templates" in BI publisher user guide)
For your requirement you can calculate the length of string and then you can use substr to get the last 9 characters. Please use the below
<?xdofx:substr('PT507170490',length('PT507170490')-8)?>
Regards,
Brajesh
0