Genii Weblog

High value methods: AppendFieldsWithJSON

Thu 19 Mar 2020, 01:05 PM



by Ben Langhinrichs
 
Inline JPEG image
 
Talk is cheap, so as a follow-up on my post, Mind the Gap - A mid-level development manifesto, I wanted to show an example that we are adding to both the Midas LSX (LotusScript) and Exciton Power (Node.js and more).
 
A major draw of our Midas LSX has always been its simplicity combined with power. Developers just venturing into LotusScript could build fairly complex applications and do high-level tasks in a few lines of code. Now, we are taking that approach even further, and adding more high value methods that meet the needs of mid-level developers, while being powerful enough for pro coders to use as well. All the mid-level value methods from Midas are still in place, and some of those were pretty high value already, but these high value methods encapsulate a set of tasks into a single call mostly driven by data, not code.
 
Today's example is AppendFieldsWithJSON. This deceptively simply method allows the developer to populate fields on a form in a variety for formats, and allows styling based on a rich set of optional parameters. In the demo below, I start with the form design in the node-demo.nsf sample database from the AppDev Pack 1.3. In that sample, the forms are basic, only really intended to hold data, not to display or edit it. I decided to show how you could dynamically create a form with the same fields (and more) using a simple JSON array of values. The goal is similar to the goal of HCL Volt, but at a level where a mid-level developer can build up a toolkit combining the automatic generation of design with the business logic needed for their individual company. Also, as we'll see in future posts, the resulting form elements can be further manipulated and enhanced with existing mid-level methods.
 
Through the demo, I show how you can tweak the script to build up to a fancier form, all using the same AppendFieldsWithJSON call. I show how you can easily add additional fields just by adding them to the JSON value. For example, the image at the top includes the simple text fields and one number field from the node-demo.nsf Contact form plus a new computed FullName field.
 
Because this process is data-driven, you can make a script that follows company guidelines and includes all sorts of common features and styles, but then dynamically create the form fields wherever you like. There will likely be additional demos for this high value method, as it can actually do much more than I show here.
 
 
 
 

Copyright © 2020 Genii Software Ltd.

What has been said:

No documents found