Overview

Sections

Automated Data Exchange & Event Control

Exploring Mongoose Architecture, Events & Low-Code Development Concepts

In this Session, we are going to touch on the technical architecture of a simple request in mongoose we will also introduce working with the event system and a few key concepts in developing with minimal code.

Understanding the flow of data

Launch Mongoose, and open the Items form from the list of recently used forms by clicking on the Form > Items menu item.

Query the data from Filter-In-Place mode by clicking the Refresh toolbar icon (Circled), or by pressing F4.

NOTE: When Refresh is clicked, Mongoose sends an IDO request XML to the app server, where the Mongoose IDO Runtime Service processes it, and sends back the results. In addition to session and metadata related requests, the core of the IDO request interface is Load Collection, Update Collection, and Invoke.

In this scenario, when we hit refresh, Mongoose sends a Load Collection IDO request XML to the server, where the IDO Runtime builds the SQL statements needed for the request. This is all taken care of by the Mongoose infrastructure and does not require any coding from the user.

Filtering data

Suppose there are millions of rows of data and you want to query only the rows which started with the letter “B”.

There are several ways to do this in Mongoose, but the simplest is Filter-In-Place.

On the Actions menu, click Filter > Begin in Place, or use the toolbar icon.

In the Item field, type: b*

Press Filter-In-Place icon or F4 key to execute the query.

To reenter Filter-In-Place mode, press the icon or press F4. Clear the filter by clicking the Actions > Filter > Cancel in Place menu item.

In the Cost field, type: >99

Press Filter-In-Place icon or F4 key to execute the filter. This returns all of the records that cost greater than $99.

You can also combine this filter with other fields. Reenter Filter-In-Place mode, in the UM field, select DZ with the Cost set to >99.

Press Filter-In-Place icon or F4 key to execute the filter. Now it will only return values that are >$99 and have a UM of DZ.

Initial commands

The initial command property specifies a command that controls what happens when the form opens. The available options are Refresh, Filter, FilterInPlace, Add, or Event <eventname>.

Refresh will open the form and query all of the data.

Filter will bring up the associated query form where you can specify a variety of filter criteria.

FilterInPlace will open the form in FilterInPlace mode so we can query specific data. Instead of querying all of the data, opening the form in Filter-In-Place mode allows the user to use filter criteria to narrow down the returned data set. This is useful for when you are working with large sets of data.

Add will open the form without querying any data with the new row inserted into the primary collection this is the default behavior for any forms you build.

Event <eventname> allows you to execute a form event. With this option selected, you can specify a specific event to be triggered upon form open.

Launch the Web Designer by clicking the icon on the toolbar. When prompted, set the Editing Scope to Site Default, and click Ok.

Open the Items form from the list of recently used forms Form -> Items. To set form-specific properties, navigate to the Properties panel and click on the Form tab at the bottom.

Under the Behavior section, set the Initial Command property to Refresh.

Click Save.

Switch back to the Runtime Mode tab and reopen the Items form. Now when the form opens, it queries all of the records.

Diagnostics

Mongoose has a built-in diagnostics tool that can be used to view messages and operations in the current session. Messages are captured and displayed in real time and can be filtered, searched, and saved to a file.

To set which events you want to see in diagnostics, open the User Preferences. While in Runtime Mode click on the View -> User Preferences menu item.

Select the Diagnostics section on the left, and under the General tab, select the Enabled option to turn on diagnostic messages.

Navigate to the Form tab and select the Events option, and under the Event Handler section select the Include option. With these two options selected, Mongoose will trace any messages coming from the events or the event handlers. Close the User Preferences modal. Click Ok.

To view the diagnostics log, select the View -> Diagnostic Log menu item.

Open the Items form from the list of recently used forms Form -> Items. Upon form open, the Diagnostics panel displays all of the messages associated with any events or event handlers. Depending on what initial command property you have set.

In the example below, we have the FilterInPlace Initial Command property set.

There are several events that Mongoose generates as users interact with the form. StdFormFilterInPlaceBegin, is generated because we had our Initial Command property set to FilterInPlace.

Click the Filter In Place icon or press F4 to execute the filter.

When the StdFormFilterInPlace event is executed, a number of other events are also generated in response to that event. You have the ability to manually trigger these standard events, or you can intercept them and attach your own custom events to them.

Intercepting standard events

In this next example, we are going to intercept a standard Mongoose event and add on to it with a custom event handler. This will display the order of events that is happening in the background using the Diagnostics tool.

Switch back to the Web Designer and open the Items form Form -> Items. From the Toolbox panel on the left click the Button component and draw it on your form.

With the button component still selected, navigate to the Properties panel on the right and expand the Events section.

Set the Primary event on the button to StdFormRefresh.

NOTE: For button components, Mongoose generates the Primary event when the user clicks on the button.

Click Save.

Switch back to the Runtime Mode tab and reopen the Items form. Click on the button we just added, Mongoose responds just as if we clicked refresh on the toolbar.

Switch back to our Items form in the Web Designer. Expand the Form Details panel, which is located on the bottom of the page.

Click the Event Handlers tab.

Select the + icon at the bottom to add a new event.

For the Event, select StdFormRefreshCompleted.

For the Type, select Prompt.

Click on the ellipsis to the right of the Parameters field to specify the Prompt parameters.

For the Message Text field, type: Hello World and then click Ok.

Click Save.

We just intercepted the standard Mongoose event and added in our own custom event handler. To view this in action, switch back to the Runtime Mode tab and reopen the Items form.

NOTE: Our event ran because our form initial command is set to Refresh and the StdFormRefresh event finished.

You will see the following prompt message. You can also manually trigger the event by clicking the button where we attached it as the primary event.

Variables

Variables are mechanisms for storing data needed at runtime. Variables are name value pairs. They can be temporary or persistent, global to all forms, or only available to the current form. In this next part, we are going to create a temporary form variable that will store a property value at runtime.

Switch back to our Items form in the Web Designer.

From the Details pane, click on the StdFormRefreshCompleted event that we just created. Click the “+” icon on the bottom left to add another event handler to our StdFormRefreshCompleted event.

For the event Type, select Set Values.

Then, click on the ellipsis button on the Parameters field.

On the Event Handler Parameters modal, click the ellipsis button on the Variables field. To Create a temporary form variable.

NOTE: Variables are mechanisms for storing data needed at runtime. Variables are named value pairs, they can be temporary or persistent global to all forms or only available to the current form

On the Edit Set Variable Values modal, click the New button.

On the Edit Set Variable Value Pair modal, for the Target, type: varTest

For the Value, type: P(Description)

This will create a variable called varTest, and the value is using a Substitution Keyword. When our event handler executes at runtime, Mongoose will interpret any substitution keywords it finds. In this case, P, is standard for Property and will replace it with the value of the Description for the current item. Click Ok until you return back to the home screen.

Click Save.

A list of all of the global variables can be found under the Edit -> Variable menu. Here you can view the properties of a variable, such as its value, version, and type.

NOTE: because our variable is a temporary form variable, it will not display in this list.

Binding a component to a variable

To view our variable being populated, we can bind it to a component on our form.

From the Toolbox panel on the left, select the Edit component and draw it onto your form.

With the Edit component still selected, scroll down on the Properties panel and expand the Data Source section.

For the Binding Type field, select Variable.

For Binding field, type: variables.varTest

Click Ok and Save.

Switch back to the Runtime Mode tab and reopen the Items form Form -> Items. You will see our variable that is bound to the edit component is now being populated with the description of the item. Click on a different row in the grid, and you will see the variable value being updated each time you switch records.

Creating custom events

Instead of having our event handler execute on the standard StdFormRefreshCompleted event, we can create our own event which is triggered from our button.

Switch back to our Items form in the Web Designer.

Expand the Form Details pane at the bottom of the page.

Select the Event Handlers tab.

Expand the StdFormRefreshCompleted event and select the Set Values event that we created in the previous step.

In the Event field, change the event name by replacing StdFormRefreshCompleted with Test.

Now select the Prompt event and In the Event field, change the event name by replacing StdFormRefreshCompleted with Test.

NOTE: Both Event Handers should now be named Test.

Select the button component we added earlier.

From the Properties panel, expand the Events section. For the Primary event field, set it to Test.

Click Save.

Reopen the Items form in runtime mode and click the button to trigger our Test event. With the diagnostics panel still open, you can see our custom event, Test, running in the background.

Summary:

We looked at the flow of data between mongoose and the IDO runtime service. We touched on basic filtering functionality variables and working with standard and custom events in Mongoose.

We briefly covered the flow of data in mongoose how when refresh is clicked an xml is sent to the IDO runtime service, where it’s processed and sent to sql and returned in the form of an update collection xml. This is all handled instinctively by Mongoose and requires no setup from the user. We covered the basics on filtering in Mongoose and how to use a wildcard character a less than or greater than to filter specific criteria as well as how to combine filters. We explored the different types of initial command actions that can control what happens when the form opens. We also learned how to turn on specific diagnostics messages in our user preferences and view the diagnostics panel in action as events were triggered on the form, we also got started working with the event system and how to intercept some of the standard Mongoose events as well as creating our own custom event. Lastly we introduce variables which are mechanisms for storing data needed at runtime, we introduce a Mongoose substitution keyword to store a property value into our variable. These substitution keywords are interpreted by Mongoose when the event was triggered.

Here is the Part 3 video showing the detailed steps to complete the previous tasks.

Was this section helpful?

What made this section unhelpful for you?

On this page
  • Automated Data Exchange & Event Control
View as Markdown

Ask an AI

Open in ChatGPTOpen in Claude