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

Using Split Function to parse data Question 1

Status
Not open for further replies.

chiplarsen

IS-IT--Management
Jan 8, 2004
87
0
0
US
Hi, I have a string that looks like this.
Patient Transferred to:CSCU
I want to split out the data from the right side of the :. I tried this, but it did not works.
Code:
 split(description,":")[1]
This returns Patient Transferred to. I want to get CSCU. Can anyone help with this function. Thank you
 
Hi,
I think it should be:
Code:
split(description,":")[2]

The Split function will create an array of 2 elements:
"Patient Transferred To" and "CSCU", so
split(description,":")[2] should return 'CSCU"



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Interesting. Both methods gave me the exact same results in testing.
 
i had never seen a negative used in an subscript like that. I tested it on some things I have and I like it! Normally my solution for the original post would have been subtract 1 from the upperbounds but I like your solution E! I took it a step farther and tried -2 -3 -4 etc... with predictable results. NEver knew you could go backwards!

split("A B C D"," ")[-5] gives you the same subscript error that split("A B C D"," ")[5] would by the way

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
excuse me ... not subtract...

split("A B C D"," ")[ubound(split("A B C D"," "))]

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
I'm trying to find the original post with that solution since it's not mine and I want to give credit where due but I'm glad it was useful :)
 
the credit is yours today! :D

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top