Community

Truncate the length of a field

I have a numeric field which consists of seven digits which sometimes has an appending "/" and one more number which indicates a page number. I have a character replacement rule to strip out the "/". Do you know how I can truncate the field to ignore the "/" and any subsequent digit? I tried a regular expression for the seven digits. Would I just create a script for this and do it that way?
0

Comments

7 comments

  • Avatar
    Sushi
    You're going to have to create a script for that. Checkout the following website. It has a really good example of what you want to do:

    http://bytes.com/topic/asp-classic/answers/526885-truncate-string-vbscript

    **Removing everything from the "?" on**

    MyString = Left(MyString,number)

    So based on this the following would work.

    MyString = "http://www.frogs.com?place=egypt"
    number = Instr(MyString,"?") - 1

    MyString = Left(Mystring,number)

    MyString now equals http://www.frogs.com
    0
  • Avatar
    Jim
    Thanks so much! Jim
    0
  • Avatar
    Harti Mutasa


    Hi Everyone, can anyone help with a matter of getting my export fields inexplicably truncating beyond my understanding. In the database I have a column defined to hold nvarchar of length of 30 on FlexiCapture test the characters from the element are all showing they are also all showing when exporting to a data file but truncate when directed to SQL Server export. Any clues anyone??
    0
  • Avatar
    Sushi


    Harti,

    It might be better if you create a new topic next time because this isn't related to the original topic. If the fields in FlexiCapture are showing correct but during the export the fields are cut off in the DB, more than likely, your issue could be your providers and drivers for the DB. Please refer to the help file for the correct driver. i.e. for SQL Server they recommend "OLE DB Provider for ODBC drivers"
    0
  • Avatar
    Harti Mutasa


    Thanks Sushi

    I will review that as a probable solution and test solution.
    0
  • Avatar
    Harti Mutasa


    Hi Shushi, we tried to resolve the matter by following your instructions but still the same result truncation is occurring. Ran a script to trace the truncation on SQL Server but the leak was not found on SQL Server. Have been in touch with Microsoft people waiting on their feedback.
    0
  • Avatar
    Sushi


    What you can do is also export to a file first. If the value is truncated there, then its some issue with your FlexiCapture project setting. If it is not truncated there, then it could be the DB setting or the connection. To test out the second part, export to some other ODBC DB like MS access and see if it truncated there. If not, it's your DB setting.
    0

Please sign in to leave a comment.