I have a filed that begins with numeirc characters and it ends with alpha character (like 0125461E). I want to alpha (E) part form the string and leave the remaining (0125461) field value.
we need to "cut" it out of our IDNumber field.
Our example field is called {USERS. IDNumber}.
Now the way we cut strings out of other strings is with the MID() function. The MID function takes three parameters. The string on which to operate, where to start and the length of the string to return.
Supposing that {USERS. IDNumber } is going to return Justin Hill, we can see the result of various MID statements:
MID({USERS. IDNumber }, 8, 1) then we will get "E"
Also note that you may omit the final parameter (length) to return "the rest" of the string, like this:
MID({USERS. IDNumber }, 8)
Example:
//Declaring variable to display message...
Stringvar message;
if (MID({REP. IDNumber}, 8 ,1)="E")
then message:="Employee"
else message:="Contractor"
Reference Links
http://blog.marksgroup.net/2010/03/crystal-reports-sorting-by-substring.html
Reference Links
http://blog.marksgroup.net/2010/03/crystal-reports-sorting-by-substring.html
No comments:
Post a Comment