Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Extracting portion of string using delimiters Post Reply Post New Topic
<< Prev Page  of 2
Author Message
siguy
Newbie
Newbie
Avatar

Joined: 29 Sep 2012
Online Status: Offline
Posts: 10
Quote siguy Replybullet Posted: 10 Jun 2013 at 8:23am
this is all within one field, but there are multiple sentences within that one field, which i am trying to link to values in another field.
 
So if the first table shows 01A, i want to extract and display everything that is in the second table after the words '01A-' and stop at the end of sentence (possibly of varying lengths.
 
Similarly if the value in the first table is 02B, i want it to take the second sentence from the second field that begins with '02B-', also ending at the end of the sentence.
 
Thanks.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 10 Jun 2013 at 9:00am
The multiple sentences in one field is what I missed.  That complicates the formula.  I am not sure when I will have time to look at this.  Sorry.  :-(
IP IP Logged
siguy
Newbie
Newbie
Avatar

Joined: 29 Sep 2012
Online Status: Offline
Posts: 10
Quote siguy Replybullet Posted: 10 Jun 2013 at 11:06am
Kev you've been brilliant in spending your efforts for me, so no need to apologise and thanks for the help so far.

What I tried to do as a work around is use multiple 'if' statements with your formula;

if {F_TASK.TASK_QUESTIONS} LIKE "*01A*" then
mid({F_TASK.TASK.NOTES},instr({F_TASK.TASK.NOTES},"01A-"),length({F_TASK.TASK.NOTES})) else
if {F_TASK.TASK_QUESTIONS} LIKE "*01B*" then
mid({F_TASK.TASK.NOTES},instr({F_TASK.TASK.NOTES},"01B-"),length({F_TASK.TASK.NOTES})) else..... and so on so forth.

Problem with this is that I can only use this as long as i don't have the 'can grow' option ticked, which will cut subsequent sentences off, and only if they are short single line sentences. Also, the formula only works if there are sentences in {F_TASK.TASK.NOTES} that contain the codes stated in the formula, if there isn't, i get a validation error along the lines of 'this is not an integer' or something similar. My guess is that I haven't defined what the formula should do if these items are not present - I have no idea how to close multiple 'if' statements and tried 'end if', but this didn't work.

Anyway thanks all the same!

Edited by siguy - 10 Jun 2013 at 11:08am
IP IP Logged
<< Prev Page  of 2
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.031 seconds.