Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: instring problem in crystal reports XI Post Reply Post New Topic
Author Message
mou84
Newbie
Newbie
Avatar

Joined: 21 Oct 2008
Location: India
Online Status: Offline
Posts: 1
Quote mou84 Replybullet Topic: instring problem in crystal reports XI
    Posted: 21 Oct 2008 at 11:50pm
Hi,
I want to achieve the following sql code in crystal reports XI syntax:

instr(OTNAME,'.',1,4)
(This implies that: the 4th occurance of '.' is to be searched from OTNAME starting from position 1)

The value of OTNAME is like this: '73.2.700.710.U.BASE.F.I.5.6.5.2134.1.2'

Please help me find a way to achieve the above in crystal reports XI    
Bratati
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 23 Oct 2008 at 2:44am
Hi,
 
Create the formula below
 
Local StringVar Str1 := ".";
Local StringVar Str2 := '73.2.700.710.U.BASE.F.I.5.6.5.2134.1.2' ;
Local NumberVar i ;
Local NumberVar c ;
     For i := 1 to Len(str2)  do
          If Mid(str2, i, 1) = str1 Then
c:= c + 1;
while c <= 13  do
c:= c + 1;
Mid(str2,c);
 
or simpler version
 
Mid (str2,14,InstrRev(str2,'.'))
 
This will only work for records where the string is always same as the data posted.
 
'73.2.700.710. then U.BASE.F.I.5.6.5.2134.1.2
 
in the above case . before U is in 13th position
Cheers
Rahul
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.