-
[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:
what can cause such an error?
-
LianjaScript variable names have precedence of field then memory variable. Perhaps you have a field of that name.
? key
Will display its value
-
Please post scripting language specific questions in the appropriate forum.. I will move this.
-
2 Attachment(s)
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?
Attachment 2524
Attachment 2525
-
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.
-
Your original post talked about foreach now you seem to have posted some thing else.
Package up and provide a reproducible example.
-
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.
-
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 :(
-
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.
-
Thanks for submitting a ticket. I will investigate.