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

Thread: [Solved] type of key

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

    [Solved] type of key

    what type of "key" is in this structure?
    Code:
    foreach myarray as key => value
    in my case line 2 causes an "Error data type mismatch" error:
    Code:
    foreach myarray as key => value
         c = lower(key)
    queried in the troubleshooter, the key content is the uppercase name of the first item, and:
    Code:
    ? type("key")
    C
    what can cause such an error?
    Last edited by barrymavin; 2021-04-23 at 02:10.

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,359
    Blog Entries
    22
    LianjaScript variable names have precedence of field then memory variable. Perhaps you have a field of that name.

    ? key

    Will display its value
    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

  3. #3
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,359
    Blog Entries
    22
    Please post scripting language specific questions in the appropriate forum.. I will move this.
    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

  4. #4
    Senior Member
    Join Date
    Oct 2012
    Posts
    239
    thanks Barry!

    Key's value also seems to be OK
    ....
    but I have other strange bugs. It may have the same cause as this type error. Maybe I mess something up in the memory, I just don’t understand how yet
    I attach two pictures of the error message. "eVal" suddenly disappears (type("eVal"= "U" ... it was "C" a few lines earlier) ... what could be causing this?
    Name:  lib_service_eValU.jpg
Views: 987
Size:  56.9 KB
    Name:  lib_service_eValU_2.jpg
Views: 857
Size:  35.4 KB

  5. #5
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,359
    Blog Entries
    22
    Provide me with a reproducible problem on a ticket and it will be looked into,

    All I see there is a snippet of code with an object reference count that has gone negative but how you got that to happen I have no idea.
    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
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,359
    Blog Entries
    22
    Your original post talked about foreach now you seem to have posted some thing else.

    Package up and provide a reproducible example.
    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

  7. #7
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,359
    Blog Entries
    22
    You have a missing bracket after your format() calls.

    that’s the error being reported.

    Look at the way you pass ‘obj’ to that function. Use ? To inspect the the array that you are traversing using foreach. That’s where the problem is.

    i think the issue is probably using foreach on a dynamic array containing objects that you referenced using Lianja.get(). I will investigate.

    you can use

    ? Key

    in the foreach loop to see the refcnt.
    Last edited by barrymavin; 2021-04-18 at 11:21.
    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
    239
    thanks Barry!
    I fixed the missing bracket error (but it's not really that error)
    Foreach was suspicious to me too and I rewrote the structure to "for". But the problem remained. I'm trying to make a reproduction sample app, but it's pretty hard .....
    in addition, the error is such that the delegate runs correctly on a given record (with unchanged data) 3x in a row and only causes an error during run 4

  9. #9
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,359
    Blog Entries
    22
    As I suggested. You need to inspect the obj at the top if the function to see what it’s refcnt is. It should be greater than 1.

    if it is not look go backwards in your code to where you assign that object checking it’s refcnt until you see where it’s wrong then submit a ticket.

    Don’t fill the forums up with debugging. Submit a ticket please.
    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
    7,359
    Blog Entries
    22
    Thanks for submitting a ticket. I will investigate.
    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

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