Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing data in memo field using Crystal formula

Status
Not open for further replies.

wangsath

Technical User
Jul 17, 2013
5
US
Hi Everybody,

I am following an old thread by (AKA IBass and SnapVampire) that have a perfect example on how to use split function to creat an array and parse out only data that you. I am hoping to catch those who have participated on that thread which have now been closed to continue with the thread and hope to provide more example that maybe beneficial for other new comers on the site.

I have a memo field that captured transactions of events that happen in an application. Treat this as a single record that track the data and kept on appending new data to this memo field. The format for the data is something like....

timestampZ submitted by XXX
content XXXXXXXXXXXXXXX

timestampZ submitted by YYY
content YYYYYYYYYYYYYYYY

timestampZ submitted by ....
content ........

I want to be able to parse out only timestamp information from each entry in the memo field. In this attempt I am using Z at the end of the timestamp(ZULU time) as the common delimiter to split the data. However, I want to get rid of everything else and display the data in the following format...

timestamp
timestamp
timestamp

I would appreciate all the guru out there that have a good solution or the formula that they can share to the community to enlight others and help.

Thank you in advance
 
From what you've shown, something like Left({your.field}, 4) would work. Or is it more complex?

Also split({your.field}," ")[1] can be used when lenghts are variable.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
I have the following code that loop through this memo field ....

StringVar Array x:=Split({My.Field}, "Z");
NumberVar u:=ubound(x);
NumberVar i;
NumberVar y:="";

for i:=1 to u do
(y:=y+x+chr(13);
y

The result ...

timestamp
submitted by XXX
content XXXXXXXXXXXXXXX

timestamp
submitted by YYY
content YYYYYYYYYYYYYYYY

timestamp
submitted by ....
content ........

Can we modify this code to remove everything else and have the result only displaying timestamp in this format...

timestamp
timestamp
timestamp

Thanks
 
Yes. Follow what I've suggesed.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
Can you show me this in sample code using what I currently have?
 

What is the exact format of the timestamp? Is it always the same length regardless of month, time, etc.?

 
It is always in 11/11/2013 00:00:00Z format. Thanks!
 
You already had the elements of the array, but since the length of the timestamp is constant you can use the right function to extract it:

StringVar Array x:=Split({YourField}, "Z");
NumberVar u:=ubound(x);
NumberVar i;
StringVar y:="";

for i:=1 to u do
(y:=y+right(x,19)+chr(13));
y
 
Thanks, that work nicely. You guys are really awesome!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top