Click to See Complete Forum and Search --> : Split Substring


DeannaUTI
May 12th, 2004, 03:44 PM
I am trying to make a report drawing information from Peachtree 2004 Manufacturing. I have a field, JrnlRow.RowDescription, that contains product information that is variable in length such as:
Waste Product *Batch# 1111 or Waste Clean-Up Product *Batch# 66342589-01. However some products we sell are not time sensitive so the line does not include the *Batch# ______,

I need to be able to extract the information to the right of the * for each record that contains the * and just have no idea how to do it. What would the formula be? Do I need to make another field that will hold the *Batch#______ information?

I appreciate any help you could give me!

dilemma
May 16th, 2004, 04:42 PM
what is the source of this report ? Is it a SQL or table ? If it's a SQL then you need to forcibly send *Batch# and let formula deal with *.. if not then your column sequence would get changed... because instead of 4 * you may get 3 * but the data belongs to different columns.

Thanks

DeannaUTI
May 17th, 2004, 11:37 AM
Split into two fields
Thank you so much for your reply and offer of assistance.
I am an absolute beginner as this is my first experience with Crystal Reports and Peachtree 2004 Manufacturing and any type of code but am enjoying it tremendously. After numerous tries and much appreciate help this is what ended up working. Maybe the code will help someone else.

I made a field called Split1 and entered this formula and it retrieved everything to the right of the *.

If Instr({@jnrlrowDesc1},"*")=0 then "" else mid({@jnrlrowDesc1},Instr({@jnrlrowDesc1},"*")+1)

I made a field called Split2 and entered this formula and it retrieved everything to the left of the *.

If Instr({@jnrlrowDesc1},"*")=0 then "" else left({@jnrlrowDesc1},Instr({@jnrlrowDesc1},"*")-1)

dilemma
May 17th, 2004, 09:23 PM
Best of Luck. You have a bright future ahead.