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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling a partial string in Crystal Reports 1

Status
Not open for further replies.

tes4444

IS-IT--Management
Oct 20, 2010
3
US
I'm a novice to Crystal Reports and programming in general but I can do a bit of SQL and have written a few reports in Crystal with a little trial and error.

I am trying to figure out how to pull just parts of data out of a very long field in a DB.

Here's an example of what the field will typically contain:

<?xml version="1.0" encoding="UTF-8"?><EVENT_LIST><RECORD><TYPE>PAID_UNPAID_BRK</TYPE><STATUS>ADD</STATUS><REF_CODE></REF_CODE><REF_NBR>TOM FIX</REF_NBR><TOTAL_WEIGHT>0</TOTAL_WEIGHT><ACT_NAME>UNPAIDBRK</ACT_NAME><BEGIN_DATE_TIME>10/13/2010 06:00:00</BEGIN_DATE_TIME><END_DATE_TIME>10/13/2010 06:30:00</END_DATE_TIME><DATE_FORMAT>MM/dd/yyyy HH:mm:ss</DATE_FORMAT><EVNT_KIND>EMP_EVNT</EVNT_KIND><PROC_ZONE_ID></PROC_ZONE_ID><LOCN_CLASS></LOCN_CLASS><LOCN_FIELD></LOCN_FIELD>
<SOURCE>MANUL_EVNT</SOURCE><LOGIN_USER_ID>200940</LOGIN_USER_ID><CRIT_LIST></CRIT_LIST></RECORD></EVENT_LIST>


I'm only interested in pulling out the Act_Name, Begin_Date_Time, End_Date_Time, and Login_User_ID.

How can I do this in Crystal? I assume I need a separate formula for each of them but that's not my challenge. I just need to figure out how to carve out only the chunks of data I want out of that huge field.
 
Do formulas with nested splits, things like
Code:
 split((split({your.field},"<BEGIN_DATE_TIME><")[2]) ,"</BEGIN_DATE_TIME><")[2]
This should give you Begin_Date_Time, and so on for the others.
If items may be missing, Ubound will tell you the number of items.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Thanks Madawc - this helped me break apart all of that glommed up data.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top