Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: working with memo fields

  1. #1
    Senior Member
    Join Date
    Oct 2012
    Posts
    125

    working with memo fields

    I have some (long) sting datas in varchar (memo) fields. When select this fields into an array , the resultset contains something like this: "@@VARCHAR@@nnnnnnnn" . How do I access the string contained in a memo field ?

  2. #2
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,105
    Hi Strato

    Here is a collection of information regarding memo fields in one place: https://lianjadeveloper.wordpress.co...ry/memo-field/

  3. #3
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,010
    mtos(memofield) will work

  4. #4
    Senior Member
    Join Date
    Oct 2012
    Posts
    125

    thanks guys
    mtos () is a really good solution if I write it in the select statement, so the array is no longer @@ varchar @@. (This, of course, makes it difficult to define virtual tables)
    It would be nice if there was a way to "decipher" @@ varchar @@ nnnnnnn ....

    ... however, there is another problem, I don't know what the correct solution is for handling arrays in a parameter list.
    How do I write an array to the current list? : "aName", aName, @aName?
    How can I change the contents and size of an array in a procedure or function so that it is returned to the calling program?

  5. #5
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,966
    Itís a bug. It will be fixed in a point release.

    objects and arrays are reference counted and garbage collected. You can return either from a function call.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  6. #6
    Senior Member
    Join Date
    Oct 2012
    Posts
    125
    Hi Barry! ... and thank you for your answer!
    what does "point release" mean? 5.5? 5.4.1? and when is it expected?
    (you're saying I can handle arrays in any form in that release, right? ... sorry for mixing the topics and my poor English)

  7. #7
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,966
    A point release means 5.4.x where x is the point. major.minor.point. It will be available when itís ready sometime over the next few weeks.

    As Iíve explained. Arrays can be returned from a function call and assigned to a variable as can objects. There are two types of arrays as described in the documentation. Static (like VFP) and dynamic.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  8. #8
    Senior Member
    Join Date
    Oct 2012
    Posts
    125
    Thanks for the explanation Barry. Now I understand the point release and that the function can return an array.
    My question was whether if an array is in the parameter list when calling a function (somehow like this: =func(array) or =func(@array) or do proc with array), then the function (or procedure) can change the the size and/or contents of the array that will be valid in the calling program?

  9. #9
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,966
    As i have explained objects and arrays are reference counted. They are passed by reference.

    Run this code and see what happens.

    Code:
    function aTest1(theArray)
        theArray[] = "hello world"
    endfunc
    
    function aTest2(theStaticArray)
        theStaticArray[1] = "hello world"
    endfunc
    
    function aTest3(theStaticArray)
        theStaticArray[1] = "hello"
        aadd(theStaticArray, "World")
    endfunc
    
    aDynArray = object()
    aTest1(aDynArray)
    
    ? "atest1"
    ? aDynarray
    
    declare aStaticArray[1]
    
    ? "atest2"
    aTest2(aStaticArray)
    ? aStaticArray
    Result:

    Code:
    atest1
    Object (refcnt=2)
    (
        [1] => hello world
    )
    
    
    atest2
    Array (refcnt=1)
    (
        [1] = hello world
    )
    
    
    atest3
    Array (refcnt=1)
    (
        [1] = hello
        [2] = World
    )
    
    
    Array (refcnt=1)
    (
        [1] = hello
        [2] = World
        [3] = World
    )
    Name:  Screen Shot 2020-10-13 at 2.24.25 PM.jpg
Views: 45
Size:  83.7 KB
    Last edited by barrymavin; 2020-10-13 at 09:31.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  10. #10
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,966
    The issue with VARCHAR being saved into arrays has been fixed non 5.4.1.

    Would appreciate it if bugs are reported as tickets rather than here which is not tracked by devteam.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

Page 1 of 2 12 LastLast

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us