Servoy Advanced Programming Guide For FileMaker Developers

Release notes for Servoy betas

Servoy Advanced Programming Guide For FileMaker Developers

Postby Morley » Wed Aug 20, 2003 3:08 am

Introduction to a series of postings

Greetings from the Lake of Bays in the Muskoka lakes district on Ontario, where I'm reading the excellent document Servoy Advanced Programming Guide For FileMaker? Developers User's Guide.

I've been making notes on points needing clarification, at least for me. I'm an experienced FMP developer and programmer, but have almost no background in any other programming environment. I find SQL as described in this document liberating. I look forward to putting the power of SQL to work with Servoy. This is exciting.

Because my notes have become so lengthy (so is the document I'm reading) I've chosen to break it up and post in a series of topics in this forum, each beginning with a page number from the source document in question.

I welcome comments and instruction. I don't imply the document is inadequate in any way. It's well written, well thought out, very worth reading. Think of this as questions from the student at the back of the class.

Two general comments. The first half of the document reviews SQL and JavaScript concepts, occasionally but hardly ever discussing FMP equivalents, thus making for very hard reading and understanding for the neophyte to these environments. The second half reverses itself, running down all the FMP script steps and functions, the Servoy equivalents, one by one.

In Chapter 4 with the introduction of JavaScript Objects I so badly lost my way I came close to abandoning ship. Objects are clearly an important concept, but without a clear foundation it proved nearly impossible to understand much of what followed. The definition of terms is terse to the point of tease, at least for this reader. I need context, examples, contrast, an explanation of the utility of Objects, what life would be like without them, etc. I have a general understanding of the overall concept, but has never had a programming environment to put them into practice. I'm still as clear as mud on this issue when it comes to the Servoy environment.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Servoy Advanced Programming Guide For FileMaker Developers

Postby Morley » Wed Aug 20, 2003 3:10 am

Page 20

<SQL databases usually do not store calculated values. In addition to columns whose values come directly from the database, a SQL query can include calculated columns whose values are calculated from the stored data values.>

I understand the first sentence, but the second one leaves me confused. Am I to understand that SQL calculations are made on the fly as needed, not indexed (ie stored) as in FMP? The following sentences in the same paragraph seem to suggest calculations are not stored as such as in FMP but are created each time required M-^W which seems awfully inefficient.

<To request a calculated column, you specify a SQL expression in the select list. SQL expressions can involve addition, subtraction, multiplication, and division. You can also use parentheses to build more complex expressions. Of course, the columns referenced in an arithmetic expression must have a numeric type. If you try to add, subtract, multiply, or divide columns containing text data, SQL will report an error.>

=====

Later on the same page is an example of a SELECT command to pull the number of the month from a "Date-Time" field. Which raises the question of how SQL stores dates. FMP stores the number of days since Jan 1, year 0001 (I believe). Which suggests SQL's MONTH function calculates the month from the stored date. Assuming SQL uses a similar number of days from a fixed point in the past that FMP does. That's a lot of assumptions. Are any of the above correct?
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Servoy Advanced Programming Guide For FileMaker Developers

Postby Morley » Wed Aug 20, 2003 3:12 am

Page 24

A syntax question. In the following command taken from paqe 24, it would seem that either functions are distinguished from column names by being in all caps, or that functions are reserved, not allowed to be used for column names.

Comments?

In the following example, the word "like" is not capitalized, the only such difference noted on this and nearby pages. Is this an error or is capitalization irrelevant?

<SELECT Name, City FROM customers WHERE name like '%soft'>

=====

<4.4.6.3 Membership test M-^W Checks whether the clause of an expression matches one of a set of values. Example: SELECT Name, City FROM customers WHERE name IN ('Servoy', 'Bob')>

The example is as clear as mud, to me.

Similarly unclear is the Pattern Matching test example. The explanations merely state the command is available without explaining the syntax in sufficient detail to be unambiguous.

=====

Later on the same page is this mysterious statement:

<In a SQL database, there is a difference between an empty field (containing nothing) and a NULL field. NULL can be seen as a special nonexistent value.>

No explanation (at least on this page) on what a "special nonexistent value" might be. Anyone have some clarifying examples?
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Servoy Advanced Programming Guide For FileMaker Developers

Postby Morley » Wed Aug 20, 2003 3:13 am

Page 25

Because the LIKE function wasn't clearly explained earlier, the following command on page 25 doesn't make much sense, at least to me.

<SELECT productname, price FROM Products WHERE price > 80 OR productname LIKE '%a'>

I don't see any records in the results shown that align as being "like '%a'". Comments?

=====

Page 27

There's a discussion about multi-table queries (joins). It gives the example of

<WHERE Customers.CustomerID = Orders.CustomerID>

This is the first introduction of the dot or period as a separator, but by no means the last. In fact the convention of term.term is quite common in both SQL and JavaScript.

I'd be far happier if there were a general discussion of this syntax, how to read, understand and use it. There's no comment about it in the accompanying text.

Way later in the text this convention of dot separators seems to be the first term is a Servoy reserved word followed by the argument. For instance: <forms.order_details.elements.firstName.selectedText();>

In other environments I would expect arguments to be enclosed in parentheses, which leads to my surprise at this convention. Here there are both dot separations and also parentheses. Some discussion would seem to be in order. I'd like to have this syntax down cold.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Servoy Advanced Programming Guide For FileMaker Developers

Postby Morley » Wed Aug 20, 2003 3:14 am

Page 28

The concept of Aliases is introduced. But the examples used seem more to be the declaration of variables on the fly. Is this just semantics, or are variables = alias in SQL?

<Here's the query using column aliases in front of the fields:
SELECT A.CompanyName, B.OrderID, B.OrderDate
FROM Customers A, Orders B
WHERE A.CustomerID = B.CustomerID>

=====

<4.5.1 Matching multiple columns>

is breathtaking in its implications, at least for this FMP developer who has long been held in by the constraints of FMP. This is an excellent example of the flexibility and frankly, the simplicity of SQL.
Page 37

=====

Page 42, declaring variables

These sound like FMP globals, except they can be created and instantly used.

Questions:

M-^U are there types of variables in the same way as there are types of globals in
FMP? Or can any variable hold a date, a time, a number, a container, etc?

M-^U since variables can be created anywhere in the code, it sounds like a programmer could, in error, use the same variable name as elsewhere unintentionally, thus overwriting an already declared variable by the same name. Is there a facility to prevent this happening unwittingly?

M-^U FMP's globals have the interesting characteristic of being true for the current user, not universal. Thus I can create a global gUserName and store the current user's name. Any time I use this global I'm sure to call up the current user's identity, none other. Is there a facility for this in Javascript. Page 42 doesn't seem to discuss this aspect.

Later on Page 50 there's a discussion of "weak typing" under section 5.3.3.3. I'm assuming this is an answer to my first question above. Confirmed? I've yet to see an answer to the other two.

=====

Page 44

<var x, y = 2, z;>

Am I correct that this example of declaring several variables in a single statement is also bad style? Only the y variable has content. The other two are null. Comments?
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Servoy Advanced Programming Guide For FileMaker Developers

Postby Morley » Wed Aug 20, 2003 3:15 am

Page 47 Boolean data types

<Undefined data type
The undefined type is used for variables or object properties that do not exist; or have not been assigned a value. The ONLY value an undefined type can have is undefined.
Example:
var x;
var x = String.noSuchProperty;
>

Sorry, this makes no sense at all. And even if it did, why would I want such an animal?

=====

Page 48

The Null data type is introduced. Is this just the same as a variable with no declared value, not even empty? Or is a Null data type a distinct entity to itself? I suspect I'm lost in a thicket. We started out talking about numbers and text data types, but now we're dealing with some exotics.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Servoy Advanced Programming Guide For FileMaker Developers

Postby Morley » Wed Aug 20, 2003 3:16 am

This one is major.

Page 54-55 introduces Objects but the description and examples here are terse to the point of tease. This sounds like a particularly powerful tool in a Servoy environment. The sections on Properties, Functions and Methods are similarly sparse and, for this reader, simply cloud the issue rather than clarify. These terse statements are essentially repeated, almost word for word, on pages 59-60 without any further enlightenment.

Can someone point me to a fuller description and explanation of these fundamentals, either within this same document or elsewhere? I've read much further and a glimmer of uncertain understanding is beginning to arise, but I'm still very wobbly on these critical concepts. Clarifications and guidance appreciated.

Page 67 says

<For example: s2 = new String("foo"); // creates a String object.
String literal
Do not confuse a string literal with the String object.
The following code creates the string literal s1:
s1 = "foo";>

Which leads me to start to think of Objects as equivalent to Variables, different ways of doing the same thing. But that can't be right since so much emphasis is being put on Objects. No, I don't understand at all, beginning with that extremely spare introduction to Objects on page 54.

It's at this point in my reading I start to skim, searching for the gist of what's being described. I've lost the thread.

=====

Page 125

Beginning with 5.7 JavaScript Flow Controls I'm back on track. This is very different from FMP's rather limited Loop script steps and exciting, offering much greater flexibility, and frankly more readable than the complex nested loops we've had to write in FMP.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Servoy Advanced Programming Guide For FileMaker Developers

Postby Morley » Wed Aug 20, 2003 3:17 am

Page 129

The following description of the JavaScript IF statement sounds suspiciously like FMP's Case statement. True? The ElseIf structure, while more verbose, seems very like the Case statement. The Switch function seems even close to Case.

FMP's nested If statements are a terror, virtually unreadable. Thus we abandoned If for the clarity and simplicity of FMP's Case statement in all circumstances.

<The expression is evaluated; if the condition is true, then the statement is executed; otherwise it moves on to the next statement.>

=====

Page 145

<Reserved words cannot be used as JavaScript variables, functions, methods, or object names. Some of these words are keywords used in JavaScript; others are reserved for future use.>

Question:

Is there automatic error trapping in Servoy to trap for inadvertent use of reserved words?
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Servoy Advanced Programming Guide For FileMaker Developers

Postby Morley » Wed Aug 20, 2003 3:18 am

Page 167

The very commonly used FMP Halt Script step apparently has no Servoy equivalent, but there is an Exit function. Exit merely exits the current script and continues processing whatever other outstanding scripts are in process. Halt stops everything dead in its tracks.

If there is no Halt Script function in Servoy, one wonders what a FMP to Servoy conversion tool would do translating FMP code? It seems odd there is no way of stopping everything. If not, why not? What are the programming recommendations for this situation? A commentary on this situation would seem to be in order.

=====

Page 178

FMP Set Error Capture -> Servoy application.setErrorCapture(boolean)

If this function is only available within Servoy Developer, what is the client's experience when an error is encountered?

Within FMP we attempt to always trap for error possibilities with our own messaging instead of FMP's often confusing and overly terse responses to errors. For instance, if the client ends up in a situation we don't believe ever could be possible, we nevertheless display our own error message as a safety precaution. Such messages typically will name the script, the file and the error number with a request to the user to notify us. In practice end users rarely encounter them, but we definitely do in beta testing. The above limitation on Error Capture to Servoy Developer only would suggest our beta testers should always be running Developer rather than Client.

Comments?

=====

Something called "Controller" is introduced on Page 178 and then used repeatedly on following pages M-^W but without explanation. From the context I can get the sense of how to use it. But what exactly is it?
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Servoy Advanced Programming Guide For FileMaker Developers

Postby Morley » Wed Aug 20, 2003 3:19 am

Page 180

Go to Related Record (GTRR) becomes <forms.detail.controller.showRecords([relationName])>
in Servoy.

GTRR is a very important command for us in FMP and actually comes in two forms M-^W go to the first encountered related record or show only related records.

The accompanying text doesn't explain the Servoy syntax very clearly. Particularly puzzled by the term "detail", and again by that word "controller".

Then there's that other issue of the "Show" condition of GTRR. What's the syntax for that?

We frequently invoke Show GTRR just before jumping to a layout, or before running a loop. But there must be dozens of different ways we use this very useful command. I need much greater clarity on this one, please. Comments?

=====

Page 183

Goto Next Field and Goto Previous Field are not currently supported. Which raises the question M-^W is tab field order supported in Servoy? Can't imagine it wouldn't be, but haven't seen it mentioned yet.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Servoy Advanced Programming Guide For FileMaker Developers

Postby Morley » Wed Aug 20, 2003 3:20 am

Page 186

Would be helpful to show a screenshot or two of the Sort dialogue in the midst of the discussion of sorting options. I'd assume the sort dialogue is customizable. Right?

Unsort is not available. Would the same effect be rendered by doing Servoy's equivalent of GTRR on the current relationship (if any), a relationship to the constant field, or use loadAllRecords?

=====

Page 198

Insert from Index not currently available in Servoy. Question: is there a way of displaying the index of a field? Is not, is it high on Servoy's wish list? For end user searching, we currently present the user with a display of fields with accompanying buttons for which present the index for the field. It's a fairly efficient and intuitive search technique. Comments?

=====

Page 204

The deleteRecord() command doesn't have FMP's warning dialogue/no warning options, right? User warnings I assume need to be created as needed. No problem.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Servoy Advanced Programming Guide For FileMaker Developers

Postby Morley » Wed Aug 20, 2003 3:20 am

Page 207

<copyAllRecords()>

One of the weaknesses of FMP is the limit on how many records can be copied by this command. Are there any limits to this command in FMP?

For FMP's Replace command Servoy recommends a loop with this note:

<NOTE: For replacing a value (updating) in a very large foundset of records, we recommend that you close Servoy Developer and run the update using a SQL tool directly on your SQL backend database.>

Within FMP, generally the Replace command is faster than doing a loop. Am I right to assume that a Servoy loop is sufficiently fast to not frustrate the end user? At what foundset of records is
it recommended to use a SQL tool directly instead?

=====

Page 210

Import and Export are NOT supported by Servoy!!! Really? This is remarkable in a product that's come out of beta. No comment on how to get legacy data in and no guidance on getting client data out??? In the works? A workaround? Comments?

No Freeze Window and Refresh Window commands? Because they're not really necessary in Servoy? Or just not yet created? In what sense is <application.updateUI()> different from refreshing the window?

Likewise no Scroll Window, Toggle Window and Toggle Status Area. Safe to assume these are in the works?
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Servoy Advanced Programming Guide For FileMaker Developers

Postby Morley » Wed Aug 20, 2003 3:21 am

Page 219

What are the limitations and flexibility of the Servoy showDialog() command? How many buttons, how many input fields? Radio buttons, check boxes? Dialogue size limitations? Control over placement of labels, fields and other elements in dialogues? It would be helpful to show some dialogue screenshot examples here. This is a very important matter for a designer paying close attention to user interface.

=====

Page 225

Send AppleEvent. We'd like to have our solutions automatically interact with other Mac programs. Likewise with Windows equivalents. Is this in the works?

=====

Page 229

No quit or exit application command? Really?!!

=====

Page 273

If there is no Servoy equivalent to FMP's Get Summary function, what is the recommended workaround?

=====

Page 297

Is that right, only four possible sources of error when running <application.getLastErrorCode()>

Good news if it is.

<
1 Connection with server lost.
2 Record is locked.
3 Invalid input.
4 JavaScript error.
>
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Servoy Advanced Programming Guide For FileMaker Developers

Postby Morley » Wed Aug 20, 2003 3:23 am

Page 295

The Servoy equivalents of Status(CurrentFoundCount) are apparently expensive in processor time. The Status(CurrentFoundCount) command is very common in our solutions, often to identify if there are any records currently selected or whether the count is above a particular number.

Some guidance on these issues would be helpful.

=====

Page

An equivalent of FMP's Status(CurrentLayoutNumber) is not available within Servoy

In FMP we use this function to store in a global so that we can return to that specific layout at a later stage in a script sequence. We use this specific Status function because it's reliable in FMP. We don't like the idea of hardwiring in a layout's name into a script when it could later be changed, thus introducing a bug into our routines.

What's the situation in this respect within Servoy? Recommendations?

=====

Page 309

Status(CurrentUserCount) is not available in Servoy. However, we currently use this FMP function to control authorized licensing of our solutions. They're licensed for so many machines. If they exceed the licensed count at any given time, the additional users are bounced off.

Is there a Servoy equivalent for this control?

=====

Page 313

We currently use the FMP design function of ValueListNames in order to prepare an index of a field. This index is then used in a dialogue to give the end user some valid choices. Neither ValueListNames nor Indexing are currently included in Servoy. What's the workaround?

This is the last of a series of 14 postings raising questions about this document.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Postby Jan Aleman » Thu Sep 04, 2003 11:23 am

Thanks for your extensive feedback, it will help us to improve this book a lot. I will try to reply to all of your questions below.

Two general comments. The first half of the document reviews SQL and JavaScript concepts, occasionally but hardly ever discussing FMP equivalents, thus making for very hard reading and understanding for the neophyte to these environments. The second half reverses itself, running down all the FMP script steps and functions, the Servoy equivalents, one by one.


Is that good or not? The idea is that you get an overview of SQL and JavaScript first and then start comparing this new knowledge to Filemaker. Did we achieve that? or not? How can we improve?


In Chapter 4 with the introduction of JavaScript Objects I so badly lost my way I came close to abandoning ship. Objects are clearly an important concept, but without a clear foundation it proved nearly impossible to understand much of what followed. The definition of terms is terse to the point of tease, at least for this reader. I need context, examples, contrast, an explanation of the utility of Objects, what life would be like without them, etc. I have a general understanding of the overall concept, but has never had a programming environment to put them into practice. I'm still as clear as mud on this issue when it comes to the Servoy environment.


We will consider adding an introduction to objects as well. There are however already many, many publications that cover that so I'm not sure that should be covered by this book.

==Page 20==

You suggest calculations in SQL databases are inefficient, this is not the case in most of the situations. Only if you search frequently for a calculated value this may become an issue. Keep in mind that SQL databases calculated much and much more efficient than Filemaker Pro. If you do need to search frequently for certain calculated values there are still several approaches in SQL to achieve this, all of these are not relevant in Servoy as Servoy does offer both stored and unstored calculations and takes care of the SQL processing that that needs.

Most SQL databases store date and time (just like operating systems and programming languages) in one field. In general the amount of miliseconds that have passed since 1-1-1970 are stored, as this can also be a negative number you can also go in the past.

==Page 24===
capitalization is not relevant in SQL as indicated on page 19, in general you do type the SQL reserved words in ALL CAPS to make your query easier to read.

WHERE name IN ('Servoy', 'Bob')

THe above is called a membership test, it searches in the field NAME for the values "Servoy" or "Bob"
In Filemaker you perform a membership testing by searching for multiple values in the same field, separating them using the 'New Request' command.

Pattern Matching is used to match parts of a string. The % sign matches one or more characters.

NULL is value that doesn't exist, the reason that it is described as special is because databases treat it differently using searches. It is impossible to give an example of NULL as it doesnt exist. It goes beyond the scope of this sql introduction to dig deeper into it, for more details a SQL introduction book would be a good purchase.

We'll try to compare searches more with Filemaker searches.
Jan Aleman
Servoy
Jan Aleman
 
Posts: 2083
Joined: Wed Apr 23, 2003 9:49 pm
Location: Planet Earth

Next

Return to Latest Releases

Who is online

Users browsing this forum: No registered users and 31 guests