split function in crystal report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kkshansid
    New Member
    • Oct 2008
    • 232

    split function in crystal report

    i have to split adress like
    raj,2d-raja road,delhi-10008. to
    raj,
    raja road,
    delhi-10008.
    i can do it with split function but its giving error msg
    Code:
    Dim x(3) As String
    x = Split ({std.addr}, ",")
    formula = x(2)
    If Isnull({std.a}) or ({std.b})= "" then
       {std.addr}
        else
        {std.prj}+", "+{std.addr}
    when i use it in formulae
    error is remaining text doesnot appear to b part of formula
    plz help me by giving example
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    just change your formula to :

    [code=vb]

    Dim x(3) As String
    x = Split ({std.addr}, ",")
    x(2)
    [/code]


    Return x(2), Instead of assigning it to the formula..

    Regards
    Veena

    Comment

    • kkshansid
      New Member
      • Oct 2008
      • 232

      #3
      Originally posted by QVeen72
      Hi,

      just change your formula to :

      [code=vb]

      Dim x(3) As String
      x = Split ({std.addr}, ",")
      x(2)
      [/code]


      Return x(2), Instead of assigning it to the formula..

      Regards
      Veena
      no its still giving same error

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        Hi,

        What is version of your CR...?

        Comment

        • QVeen72
          Recognized Expert Top Contributor
          • Oct 2006
          • 1445

          #5
          Hi,

          I Guess, CR9 and above support Split Function..
          Also Change your Formula To :

          [code=vb]
          whileprintingre cords;
          Stringvar array MyAddr:=split({ MyTable.MyField },",");
          If Len(MyAddr) >= 2 Then
          MyAddr[2]
          Else
          ' ' ;
          [/code]

          Regards
          Veena

          Comment

          • kkshansid
            New Member
            • Oct 2008
            • 232

            #6
            Originally posted by QVeen72
            Hi,

            I Guess, CR9 and above support Split Function..
            Also Change your Formula To :

            [code=vb]
            whileprintingre cords;
            Stringvar array MyAddr:=split({ MyTable.MyField },",");
            If Len(MyAddr) >= 2 Then
            MyAddr[2]
            Else
            ' ' ;
            [/code]

            Regards
            Veena
            thanx
            its cr 9
            whileprintingre cords;
            Stringvar array MyAddr:=split({ std.addr},",");
            If (count(MyAddr) >=4) Then
            MyAddr[1]+
            MyAddr[2]
            problem is that second array is printing in same line
            i want to print in second line
            is there any newline formula in crystal report???
            thax again for your support

            Comment

            • QVeen72
              Recognized Expert Top Contributor
              • Oct 2006
              • 1445

              #7
              Hi,

              I Guess, Any of these should work..

              MyAddr[1] + Chr(13) + MyAddr[2]
              OR
              MyAddr[1] + Chr(10)+Chr(13) + MyAddr[2]
              OR
              MyAddr[1] + Chr(10) + MyAddr[2]

              Also, you need to Format the FormulaField to Print on Multiple Lines..
              Check the "Can Grow" option..

              Regards
              Veena

              Comment

              • kkshansid
                New Member
                • Oct 2008
                • 232

                #8
                thax but when i use char(10) or char(13) it gives some space with new line
                like
                a-13 sarojini nagar,
                new delhi-11002.
                i dont want space in second line and in other remaining lines

                Comment

                • QVeen72
                  Recognized Expert Top Contributor
                  • Oct 2006
                  • 1445

                  #9
                  Hi,

                  Chr(13) should work..
                  Did you format the FormulaField with "Can grow" option..? also adjust the physical width of the Formula field..


                  Regards
                  Veena

                  Comment

                  • kkshansid
                    New Member
                    • Oct 2008
                    • 232

                    #10
                    space by newline character

                    sorry but previous example i given was not right its like i adjusted formating grow option its like

                    Code:
                    a-13 sarojini nagar,
                      raj nagar
                      new delhi-11002.
                    i want r of raj nagar right bekow a
                    Last edited by kkshansid; Nov 20 '08, 02:11 PM. Reason: example not correct

                    Comment

                    • QVeen72
                      Recognized Expert Top Contributor
                      • Oct 2006
                      • 1445

                      #11
                      Hi,

                      Try Combination of
                      Chr(13) & Chr(10)

                      (in the same order)

                      Regards
                      Veena

                      Comment

                      Working...