NeoSqlJson - Forum

Forum Navigation
You need to log in to create posts and topics.

NeoSqlJson

If I use this syntax

LoadJSON "https://jsonplaceholder.typicode.com/todos" [myjson]
SetVar [myquery] "select * from ? where id < 3"
neoSqlJson [myjson] [myquery] [mydata] ""
ConsoleLog [myjson]
. myjson gives 200 todos
ConsoleLog [mydata]
. mydata always undefined
. data successfully parsed
. no errors

I think this should work but it does not.  mydata is always undefined.
What is the right syntax for NeoSqlJson?

@kajanken neoSqlJson is an asynchronous command. It takes time and once it has finished calls a callback subroutine.
You are not waiting for the command to finish so [mydata] is allways undefined.

Try this instead:

LoadJSON "https://jsonplaceholder.typicode.com/todos" [myjson]
SetVar [myquery] "select * from ? where id < 3"
neoSqlJson [myjson] [myquery] [mydata] ""

Wait 300
   ConsoleLog [mydata]
EndWait

As you can see I have just included a wait of 300 milliseconds, but it's better to use a callback function instead.
Let me know if you need additional assistance.

Regards,

kajanken has reacted to this post.
kajanken