PDA

View Full Version : KEYLOOKUP() in LCS



HankFay
2014-02-04, 13:53
I didn't really expect keylookup() to work in LCS, and in fact it does not. Given that it's part of Lianja VFP, that was expected.

There is mention in the roadmap of using JavaScript functions to access local cursors.

Is there an example of doing so in the existing samples? Or is something else planned?

thanks,

Hank

PS: I put a Lianja.evaluate([...]) around the keylookup, figuring this would force evaluation on the server. It works on the desktop, but still no joy on LCS.

PPS: I'm guess that accessing the data through the JS dataengine would be the way to go. Tried using the database and recordset classes per the wiki, but I must be missing something.

barrymavin
2014-02-04, 21:12
Hi Hank,

What is it you are trying to achieve?

calculated fields and OData extensions for data mapping are in the roadmap as are delegates and custom JavaScript libraries.

HankFay
2014-02-04, 21:25
I was trying to use a GET expression for a user-friendly display of an FK field. I had read the roadmap, didn't see any reference that seemed to fit.

thanks,

Hank

barrymavin
2014-02-05, 00:12
Hi Hank,

thats the OData extensions for data mapping. This will be handled automatically by the web client when it reads and updates data as is currently the case with the desktop client.

HankFay
2014-02-05, 00:37
Hi Barry,

fantastic. I was thinking of rolling my own in JavaScript, using the Database and Recordset classes, figuring I'd open the data in the client in JS, create an index on the recordset using SQL, and then write a function to do a seek on the recordset. The question being: will doing so in the page itself open the data on the client?

thanks,

Hank

barrymavin
2014-02-05, 02:34
Hi Hank,

I'd recommend waiting for the LianjaWebFramework classes before doing anything like that.

You don't need to process data like that on the client. You can call any server side procedures. Also OData has all that built in and this is easier to use and consume the JSON result in your client App.

Whenever you want to perform any custom CRUD operations I'd recommend OData calls. This Web Client API (using the Lianja System Object) will be documented along with an explanation of how to use the LianjaWebFramework classes when they are completed as per the roadmap.

When the custom LianjaWebFramework classes are available the Database and Recordset classes will use async OData calls internally.

The Web Client JavaScript API has a way of posting multiple async calls to the server and chaining them together as each one completes. This in fact is how {...} macro substitution is performed and is particularly useful when macros are nested e.g {myfunc('{{customers.customerid}}')}

Notice that in this example {{customers.customerid}} is substituted on the client which maintains local cursor state, in this case referencing the customerid field in the customers local cursor. Following that the myfunc() procedure in the app directory is called and the result it returns is substituted in place of the macro.

I will put some examples together as we progress.

HankFay
2014-02-05, 12:15
Hi Barry,

thanks for the clarification.

Hank