Skip to Content
author's profile photo Former Member
Former Member

How to trim 1122 out from 1006;INV1122;SRNO1236

Post Author: leongcy23

CA Forum: Formula

Dear forums buddy,

I got a situation here where I need to extract out the 1122 from the Ref note 1006;INV1122;SRNO1236. Now it will be easy if the length for the first few integer is fix. Mid (Cal.Ref, 9, 4)

But now my problem is that the 1006 sometimes will be in 2 or 3 character only. So its hard for me to extract it.

So do anyone have any idea on this? Need help here. Thanks

Anson

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 07:21 PM

    Post Author: Charliy

    CA Forum: Formula

    Is there anything else that is constant? Are ther always three letters after the first semicolon? Do the target numbers alway precede the second semicolon?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 07:48 PM

    Post Author: SKodidine

    CA Forum: Formula

    I am not sure when you mention "extract out" if you wanted the string minus 1122 or just want the 1122.

    If you want the string minus 1122 here is what you do.

    stringvar x := '1006;INV1122;SRNO1236';stringvar y := '1122';

    mid(x,1,(instr(x,y)-1)) & mid(x,(instr(x,y)+4),len(x));

    If you want the 1122 alone then do this:

    mid(x,(instr(x,y)),4);

    replace x with the table field.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 12, 2007 at 02:20 AM

    Post Author: leongcy23

    CA Forum: Formula

    Dear Charliy,

    There is no others constant value other than the first 4 digit. The integer before first semicolon is amount ($), so its will change always. Whereby integer after first semicolon and second semicolon is code, so the length is fix.

    Yes, there's always 3 letther after the first semicolon.

    Yes, the target no. always precede the second semicolon

    Thanks

    Anson

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 13, 2007 at 02:34 AM

    Post Author: leongcy23

    CA Forum: Formula

    Now what I want to know is how to take out the value after the first semicolon and before the second semicolon. There is always two semicolon in this Ref notes.

    Thanks

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 13, 2007 at 04:37 PM

    Post Author: SKodidine

    CA Forum: Formula

    split(x,";")[2];

    where x is Ref Notes.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 13, 2007 at 07:31 PM

    Post Author: Charliy

    CA Forum: Formula

    mid(split({cal.ref),':',[2]),4,4)

    You might have to tune it a little, but the Split gives you what comes after the first semicolon, then the Mid gives you 4 characters starting at the 4th character.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.