CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: SPLIT function,

  1. #1
    Join Date
    Jan 2010
    Posts
    1

    SPLIT function,

    Hey there,

    I am using crystal reports with vs 2008 express and i am having trouble with one part. I have a parts filed in my database and I need to insert each part into a different unbound field. I have been trying to use the split function but I can't get it to work. The parts list can unlimited so there is no way i will know how long to loop for.
    This is how the string appears in the database.

    Airfliter - 1 - 12 + Oil - 1 - 12 + FuelFilter-2-3

    Each is separated by a + and PartName-QTY-Cost is the break down of each part its self .

    please does any one have a idea what to do.
    Even if each part would go on to the next line in the textbox that would do. any ideas are welcome
    thanks
    james

  2. #2
    Join Date
    Jul 2005
    Posts
    1,083

    Re: SPLIT function,

    Try the next:
    Insert a new formula field, any name, and put it in details section,
    format the formula field checking CanGrow property
    (Also change {Table.Field} by your table and field name)
    Code:
    WhilePrintingRecords;
    StringVar array MyArrayI := Split({Table.Field},"+");
    StringVar MyListO := "";
    NumberVar X:= Ubound(MyArrayI);
    NumberVar Counter;
    For Counter := 1 to X Do(MyListO := MyListO + MyArrayI[Counter] + Chr(10));
    MyListO;
    Hope it help
    JG

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured