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!

splitting a field into two separate field 1

Status
Not open for further replies.

JMcVeigh

Instructor
Mar 27, 2003
21
0
0
US
I have a string field that has a / (slash) in the middle and I need to split it at the /. I do not need the / in the 2 resulting fields.
any help is appreciated.
Thanks.


 
Name : {@StringBreak}
Formula : Replace ({Table.Field},"/" ,chr(13))

Make sure the field is formatted with "Can Grow" so that you can see all the results.
 
Thanks for that, but I actually need to make two separate fields out of this and not one field that has a line break. (I can use this idea for something else - so thanks for that)

The end result of the report I am writing is to create a delimited file. Is there a way to take the one field and with two different formulas, make it two values (data before and data after the /)
In MS Excel, I can finagle this with using the find formula to find the character position of the / and work with it from there. Is there anything like that that you can think of...
Again, thanks in advance.
 
To create two separate fields, try two formulas:

split({table.field},"/")[1]

split({table.field},"/")[2]

If the field sometimes does not include the "/", then add an introductory clause to each formula:

if instr({table.field},"/") > 0 then //continue with formula 1 or 2 above

-LB
 
Thank you lbass - that is exactly what I needed.
 
Another way to skin this cat...

Name : {@StringBefore}
Formula : LEFT ({Table.Field},(InStr ({Table.Field},"/") - 1))


Name : {@StringAfter}
Formula : RIGHT ({Table.Field},(InStrRev ({Table.Field},"/") - 1))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top