Was this helpful?
generate Statement--Generate 4GL Source Code
Generates 4GL source code based on specifications in the frame definition or escape code.
This statement has the following syntax:
## generate code_type {argument,...}
The code_type can be any of the following types:
check_change
Generates 4GL inquire_forms statements based on the setting of the Update Integrity rule for Update frames. The only argument this statement accepts is join_fields. This statement generates a 4GL inquire_forms statement and other 4GL code to check whether the value of any of the join columns has been changed for the Master table of an Update frame.
Syntax:
##generate check_change join_fields
copy_hidden_to_visible join_fields
Undoes changes to the value of the Master and Detail table join columns. Used in Update frames when the Update Integrity Rule restricts updates on the join column.
Syntax:
##generate copy_hidden_to_visible join_fields
help
Generates a 4GL help_forms statement, copies the named help file from the template file directory into the application's source directory, and gives the help file the same name as the ".osq" source file.
Vision creates one or more help files for each frame based on the frame type and frame definition. You can edit the help files that Vision creates, as discussed in the Vision-Generated Help Files section in Modifying Vision Code.
Syntax:
##generate help helpfilename
For example, the following statement moves the named help file to the source directory and gives it the same name as the frame:
##generate help fgmdupda.hlp
hidden_fields
Defines local variables, or hidden fields, for the frame. The name of each hidden field that Vision generates begins with "iih_." Local variables can be any of the following:
hidden fields (columns which are marked "n" on the visual query)
column names for primary keys and join fields in Update frames
column names for non-displayed sequenced fields in Append frames
columns which are marked "v" on the visual query
user-defined local variables
user-defined local procedures
Syntax:
##generate hidden_fields
load_menuitems
If a menu frame is in table field style, then this statement populates the table field.
Syntax:
##generate load_menuitems
local_procedures
Generates user's local procedure code. The optional declare keyword generates the declare section for the local procedure.
Syntax:
##generate local_procedures [declare]
lookup
Generates most of the code for the ListChoices menu item. This code tests for whether the cursor is on a Lookup table activation field. If so, then a 4GL callframe look_up ( ) statement is issued.
Syntax:
##generate lookup
query
Generates the query appropriate for the frame type and visual query specifications. The full syntax of this statement is:
## generate query query_type VQtable [repeated] [noterm]
query_type
Is any of the following:
select for Browse and Update frames
insert for Append frames (and Update frames that allow inserts of new Master or Detail table records)
update for Update frames
delete for Update frames that allow deletions of Master or Detail table records
VQtable
Is one of the following:
Master table only
Detail table only
(Select queries only) Master_Detail for generating a Master/Detail select query
repeated
Is an optional keyword that generates repeat queries (repeat queries run faster than non-repeat queries on second and subsequent runs).
All Vision-generated queries use this keyword, except those that use a 4GL qualification function.
noterm
Is an optional keyword that causes the query statement to be generated without a semi-colon (;) as a statement terminator
Queries that have an attached submenu use this keyword. For example:
## generate query insert master
tells the code generator to formulate a 4GL insert statement to append data to the Master table. This statement appears in the Append frame's template file.
Another example:
## generate query update master repeated
generates a repeat query to update the Master table.
set_default_values simple_fields
Assigns default values for displayed fields of the Master table on an Append frame, based on values specified in the Assignment/Default field of the Visual Query.
Syntax:
##generate set_default_values simple_fields
set_null_key_flags master|detail
Handles update and delete statements for Master or Detail tables that have nullable keys. Used with an ##IF $nullable_master_keys or ## IF $nullable_detail_keys statement.
Syntax:
##generate set_null_key_flags master | detail
user_escape
Generates a begin-end block to insert 4GL escape code at the appropriate location in the source code file. The escape code is inserted exactly as written. The code generator does not scan it for any template language statements, substitution variables, or logicals or environment variables.
The full syntax of this statement is:
## generate user_escape escape_type
In general, the value of escape_type corresponds to the type of the escape code as displayed in Vision except the escape_type name contains underscores (for example, "form_start") instead of dashes ("Form-Start"). The following cases are exceptions:
The value "after_field_activates" represents both the After-Field-Change and After-Field-Exit escape types.
The value "before_field_activates" represents the Before-Field-Entry escape type.
user_menuitems
Generates a menu activation block for each menu item that you have specified for a frame (that is, each of the frame's child frames in the Application Flow Diagram). The block includes the necessary callframe statements and any Menu-start or Menu-end escape code you have specified.
Last modified date: 04/03/2024