Results 1 to 8 of 8

Thread: Array elements

  1. #1
    Join Date
    Mar 2004
    Location
    California
    Posts
    502

    Unanswered: Array elements

    StNo Street Name
    18880 Nordhoff Street #6

    Desired result should be

    StNo Street Name
    18800 Nordhoff Street #6

    The code below successfully copies just the street number away from the street address field and places it in the StNo field.

    But it does not delete the street number from the original street address filed
    leaving just the street name and all elements to the right of street name.

    ANY IDEAS ON HOW TO DO THAT?
    Thanks . . . Rick

    method run(var eventInfo Event)
    {breakApart method. This syntax is used to separate
    the street number from the street name}
    Var
    ImpMoore1 table
    ar Array[] String
    tc tCursor
    s,str String
    si SmallInt
    endVar
    {-----------------------------------------------------------------}
    addAlias("MYDIR","Standard","D:\\Pdoxwin7\\Moore")
    {-----------------------------------------------------------------}
    if Not tc.open("D:\\Pdoxwin7\\Moore\\ImpMoore1.db") then
    errorShow()
    return
    endif
    tc.edit()
    scan tc:
    str=tc."AddressDisplay".value ;field name in table
    str.breakApart(ar, " ") ;use space as delimiter
    for i from 1 to 1 ;limites data to the left of the first space in the field
    str=ar[i] ;assigns data to str from left of first space in field
    endfor

    tc."StNo".value=str ;places str value in StNo field
    endscan
    tc.close()
    endMethod

  2. #2
    Join Date
    Sep 2003
    Location
    Dallas
    Posts
    182

    Add the following

    after : tc."StNo".value=str ;places str value in StNo field

    tc."Address" = substr(tc.addressdisplay.value,length(str)+2, 40)

    That will pull out the address beginning with the value after the space and including up to 40 characters thereafter. You can adjust it if the actuall addressplay field can be longer.

    Lonnie

  3. #3
    Join Date
    Mar 2004
    Location
    California
    Posts
    502

    Array Assignments

    Hey Lonnie . . . that looks great. I'll try it as soon as I can and let you know how it works.

    Thanks much!

    Rick

  4. #4
    Join Date
    Mar 2004
    Location
    California
    Posts
    502

    Unknown Method Name

    Hi Lonnie . . .

    tc."Address" = substr(tc.addressdisplay.value,length(str)+2, 40)

    When I added this to my code as you suggested, I get the following error with the word "length" highlighted . . . Unknown Method Name

    Any ideas . . ?

    Thanks . Rick

  5. #5
    Join Date
    Sep 2003
    Location
    Dallas
    Posts
    182

    Red face Oops wrong language

    tc."Address" = substr(tc.addressdisplay.value,str.size()+2, 40)

    If you substitute this line (str.size() replacing length(str) it should work.

    Of course that assumes that you have a field called address. If not you need to replace the tc."address" object with your field name.

    Lonnie

  6. #6
    Join Date
    Mar 2004
    Location
    California
    Posts
    502

    Opps . . . wrong language!

    Sheesh, I sure wish I had the intellegence you have Lonnie.

    I have to fight just to get Paradox into edit mode. Ha!

    I'll get back to you.

    Thanks again . . . Rick

  7. #7
    Join Date
    Mar 2004
    Location
    California
    Posts
    502

    Got It Lonnie . . .

    That fix did the trick.

    Thanks . . . I mean THANKS MUCH for your help Lonnie.

    Rick

  8. #8
    Join Date
    Sep 2003
    Location
    Dallas
    Posts
    182

    Glad it worked!

    Glad to do it!

Posting Permissions

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