The Omnis Advantage: Part 4 – Tab Completion

dswain_post4_tab completion

In my last post about Syntax Checking, I stated that Omnis Studio saves us debugging time by not allowing us to create syntactically incorrect expressions in our code (it can’t correct our logic, but this is still a big step!). Now I want to mention some of the ways it helps us write those expressions faster as well. One of the principle features that helps us in this way is:

Tab Completion

Yes, Omnis Studio also provides “Tab Completion”, whereby our code is completed simply by tabbing, but this is required in a much narrower scope than in other programming languages that offer it.

When I mentioned in an earlier post that the combination of Omnis Tokenization and Keystroke List Navigation in the Method Editor was faster for building methods than Tab Completion in other programming languages, I wasn’t dismissing Tab Completion as a programming feature as being useless. Far from it – Tab Completion is most efficient when we need to quickly add correctly spelled single-word items to a string, not entire complex commands that have a multi-word syntax.

So where can we use this in Omnis Studio? We can use it for adding variable and column names, notation string segments and related items within expression strings. When we are certain – or reasonably certain – of the item name we want to use, Tab Completion is the fastest way of entering it. Tab Completion also assures us of correct spelling, again saving us that particular debugging headache.

As we enter the string for an expression, Omnis Studio “watches” our keystrokes and is aware of the context within which we’re working. The first keystroke in a field that expects to see an expression, or the first keystroke after any operator, can potentially be the beginning of an item name. Since variable and column names MUST begin with an alphabetic character, typing such a character and then pausing for a moment (“moment” will be defined later in this post) triggers the Tab Completion search mechanism and a list of all in-scope variables that begin with the letter or string that has been typed so far is presented as a drop down selection list.

 

Omnis creates a list of possible variable names automatically.

What we do with this list can vary a bit. If there is only one item in the list and it happens to be in the item we want, simply hitting the Tab key will place the entire item into the expression string, hence the name “Tab Completion”. If the list is longer and we decide selecting from the list is easier than typing more characters, we can simply use the down arrow key to scroll quickly to the item we want and then press the Enter/Return key to place the selected item in the expression string. Maybe typing another character or two would let us use the Tab key instead so this is a judgment call.

We’ve now covered the use of Tab Completion for variable and column names. But, if Omnis Studio notices that we have begun writing a notation string, each period (full stop) character represents the beginning of a new notation segment. In this case, any alphanumeric character, dollar sign or hash symbol will be seen as the first character of the next segment (hash marks as the initial character as described in the previous paragraph signal that we want the name of a hash variable and a dollar sign as the initial character indicates we are beginning a notation string.). A left square bracket marks the beginning of an embedded expression within the notation string so Omnis Studio switches to “expression mode” (my term) because of this change of context. And that expression could include a notation string, etc.

 

Omnis shows you the next item in the context of the whole expression.

 

This feature is really referred to as “Notation Help” rather than “Tab Completion”, since we don’t always use the Tab key to complete the item. “Notation” is being use broadly here to mean “any expression element”. Operators are generally only 1 or 2 characters long, numbers are values that must be directly entered and character and date strings are not tokenized, so help can’t be offered for these. Functions also can’t be selected this way, but their names usually require a few keystrokes anyway.

How much of a pause causes the Notation Help to kick in? That is determined by the value of the general Omnis Studio property “notationhelptimer” (to view this property in Omnis, click on “Studio 5.x” and then “Prefs” in the Studio Browser). It holds a numeric value that is interpreted in milliseconds and defaults to 1000, so 1 second by default. Changing this applies the new value to that copy of Omnis Studio, not to a specific library or project.

OK, we now know a few features of Omnis Studio that can save us development and/or debugging time when we know more or less what we’re doing – that is, we know the EXACT names of the items we want to use in our code. But, what if we’re less sure? There are features to help speed us along in those situations too, which we’ll begin exploring in my next post.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>