Editing Your Update Assist Application

In this section:

When you click Finish in the Update Assist (Step 4 of 4) - Summary dialog box, the files that comprise your Update Assist project are generated. For a list of files, see Files Generated By Update Assist.

If you wish, you can perform further editing on these files.


Top of page

x
Customizing the Tree Control

The Tree control option for Update Assist applications enables users to find the record they are looking for by navigating through a tree hierarchy. You can add the following JavaScript variables in the MasterFileName_navbar.htm file to control this hierarchy:

These variables and the values you wish to set for them can be added to the area of code inside the MasterFileName_navbar.htm file that generates the tree, using the syntax

maintainTree.maxNodesPerFolder =

and

maintainTree.maxFolders =

prior to the maintainTree.init() code.

For example:

var maintainTree = new maintainTreeInfo(constructFields(),mCallBack);
linestyle = "white"; 
maintainTree.maxNodesPerFolder= 8; 
maintainTree.maxFolders = 20;
maintainTree.init();

Note: If the maxNodesPerFolder and maxFolders values are set in a way that would cause a conflict, the setting for maxFolders takes precedence over maxNodesPerFolder.


Top of page

x
Calendar Control for Date-Formatted Fields

A calendar icon appears next to changeable date-formatted fields. When a user clicks the calendar icon, a calendar appears, as shown in the following image. Any date selected on this calendar is entered into the date field. Users can also enter dates into the date field manually.

Calendar diagram


Top of page

x
Date-Stamping Fields

How to:

Many DBMSs allow you to create a time stamp field. This automatically fills the field with the current date and/or time and saves the user having to do it. There are many reasons at an application level for doing this. The most common is to give reporting applications some way to track when a record was first created or when each change was entered.

Note: If you are using an external DBMS that directly supports Date and Time Stamp field types, you will not need to use this technique. Instead, make sure the field that contains the time stamp is set to Changeable = No to prevent Update Assist from touching that field.



x
Procedure: How to Date-Stamp a Field in an Update Assist Application

To date-stamp a field in an Update Assist application, so that when a user clicks New, the application can set the initial value of the field to the current date in the stack before it is displayed in the form:

  1. Open the SegmentName.mnt file in the Maintain Development Environment.
  2. Add the following line of code to the top of the Maintain, just above Case Top:
    MODULE IMPORT(MNTUWS);

    This imports the library of functions included with WebFOCUS Maintain.

  3. Scroll down to the newrecord case and add the following code right below the first Stack Clear statement:
    COMPUTE TheDate/MDY = Today();
    COMPUTE stack.datefield = TheDate;

    where stack and datefield are the stack name and field name to which you want to assign the current date.

Note: If you have multiple fields that need to be set to the current date, you only need to set the variable TheDate once and can reuse it as many times as you need.



Example: Date-Stamping a Field in the MOVIES Data Source

If you wanted the Release Date field from the MOVIES data source to contain the current date, your code would look like this:

COMPUTE TheDate/MDY = Today();
COMPUTE Movinfo_stack.RELDATE = TheDate;

Top of page

x
Auto-numbering Fields in Update Assist Applications

How to:

Some DBMSs allow you to create an auto-number field. This automatically fills the field with a sequence number that is the last record index plus one. This saves the user having to make up an arbitrary key for the record.



x
Procedure: How to Auto-Number a Field in an Update Assist Application

To auto-number a field in an Update Assist application, so that when a user clicks New, the application can set the initial value of the field to the next sequence number in the stack before it is displayed in the form:

  1. Open the SegmentName.mnt file in the Maintain Development Environment.
  2. Scroll down to the newrecord case and add the following code right below the first Stack Clear statement:
    Stack clear SegmentNameStk;
    For all next MasterFileName.SegmentName.autonum into SegmentNameStk;
    NextVal/I5 = SegmentNameStk(SegmentNameStk.FOCCOUNT).val + 1;
    Stack clear SegmentNameStk;

Note: If you are using an external DBMS that directly supports Date Stamp field types, you will not need to use this technique.


Top of page

x
Continuing to Display Current Values After a New Action

How to:

By default, Update Assist clears all text boxes and controls in the form on a New action. You can have the values stay in the text boxes by editing the SegmentName.MNT file.

For example, users of some types of applications may be entering many similar records, one after another, and would like to display a record, then essentially have the New action display a copy of the record which they can edit before clicking Save.



x
Procedure: How to Continue Displaying Current Values After a New Action
  1. Open the SegmentName.MNT file and go to the newrecord case.
  2. Comment out the line that clears the stack, using a double dollar sign ($$).

WebFOCUS