What are limits of Servoy's JavaScript Implementation?

Release notes for Servoy betas

What are limits of Servoy's JavaScript Implementation?

Postby konsta » Wed Sep 13, 2006 10:51 am

I've seen try/catch referred to on this forum, but I have not been able to get it to work reliably in Servoy Beta v. 3 RC4. I've also noticed that not all functions (e.g. toString() ) are available. Is there a listing of what features of JavaScript are unavailable?

Also, if anyone can point me in the direction of documentation regarding SOM, I would greatly appreciate it. I have spent a fair amount of time trying to get a listing of all forms and their elements using associative arrays, but I keep running into errors. I'm trying to get a good handle on the object model and I keep running into problems that I can't get around.

Can anyone suggest a resource?

---Andrew
Andrew Konstantaras
[email protected]
konsta
 
Posts: 7
Joined: Mon Sep 04, 2006 3:47 am

Postby IT2Be » Wed Sep 13, 2006 1:09 pm

Hi,

Imho
Code: Select all
try {} catch {
works but doesn't always throw an error where you expect it.

toString() works, try this
Code: Select all
var number = 13;
application.output(number.toString());


A lost of the available JS functions are listed under JS Lib.

A good source would by my Pre-Servoy World class :)
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4763
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby konsta » Wed Sep 13, 2006 5:04 pm

Hmm, my problem with try/catch is that I'm still getting an method-terminating error when I use it (a bizarre one, in fact, I'm getting an out-of-bounds array reference when I am at j = 2 while looping through an object whose associative array has a length of 40.

I have not tried .toString() for converting numbers to strings (since loosely typed languages do that for me). I usually use .toString() to identify a variable's type (e.g. string, integer, object, etc.).

Perhaps you can help me in my ultimate goal, which is to loop through all objects in a solution to find out their properties (both names and values). If anyone has an idea how I can (programatically) get all the methods/functions as well, that would be great.

When I have used JavaScript techniques that have worked in different environments, I get errors. For example, I can't seem to pass a form as an argument to a global method - to get around it, I pass the form name and access the form inside the method by referring to it via forms['name'].

This approach only takes me so far, as I try to iterate through a form's properties using the same approach (e.g. object[propertyname]), I invariable run into an error of one type or another. First I tried checking to see if the property is null before printing it in the loop, which seemed to work sometimes, but still didn't solve the error problem. Then I attempted to use try/catch, which just created another error (this time, one I can't seem to understand, as I explained above).

Perhaps what I am trying to do is not possible without writing a plugin. At the end of the day, what I would like to see is a complete description of the objects in the Servoy Object Model. Once I have this (or rather, know how to get it, I should be able to get a listing of all the objects and their values in a solution).

If it would be helpful, I am happy to post the code I am using for this as well as the output that gets produced.

Again, any guidance is much appreciated.

---Andrew

P.S. I am using the CRM app provided with Servoy as my testbed.
Andrew Konstantaras
[email protected]
konsta
 
Posts: 7
Joined: Mon Sep 04, 2006 3:47 am


Return to Latest Releases

Who is online

Users browsing this forum: No registered users and 2 guests