Macros list

Print Previous page Top page Next page

ici_9142 «Macros list» allows enhancing functionality when working with user forms.

Component properties: Name. Macros list.

Name - contains the name (identifier) of the component, which is used to refer to this component.

Macros list - is used to call the «Macroses editor». With the help of the «Macroses editor», you can perform the following actions:

- Rename the macro name;

- Add a macro;

- Delete a macro.

 

Macro with a name «Form_macros1» is automatically added at pressing «Add» button in Macroses editor. For this macros it is necessary to select the Macros type in «Object inspector». Macros type defines execution of definite operations:

- Enable/Disable filtering;

- Call geocoding form;

- Close data;

- Write the form name to the table;

- Run Dll;

- Run application with parameters from the table;

- Run application;

- Plot point objects;

- Open a URL;

- Open data;

- Open map;

- Open form from the table;

- Report for DS (Data Set);

- Calculate on map;

- Create query;

- Create a parameterized filter;

- Create filter;

- Save the query to a temporary table;

- Save DS to a file.

 

Each type of macro has at least two properties:

- Name - contains the identifier of the macro used to reference it;

- Macros type - determines the type of actions performed.

 

The macro «Enable/Disable Filtering»  has the following properties:

- Data set - defines the link to the data access component's name (Table, Query, Parameterized Query) that connects to a specific set of information from the database.

- Set filtering - selecting "Yes" filters the "Data set," selecting "No" resets the filter.

 

The macro «Call Geocoding Form» has the following properties:

- Data set - defines the link to the "Table" component (or "Query") that connects to a specific set of information from the database.

 

The macro «Close Data»  has the following properties:

- Data set - defines the link to the data access component's name (Table, Query, Parameterized Query) that connects to a specific set of information from the database.

 

The macro «Write Form Name to Table» has the following properties:

- Form name field - specifies the table field where the user's form name in the project is recorded.

 

The macro «Run Dll» has the following properties:

- Dll field name, Dll file name - specifies either the table field containing the Dll name or the filename with the Dll extension;

- Dll type - selects standard or extended Dll type.

 

Extended type. To call a task in the module, a function declaration must be made:

extern "C"

{

  long int _export WINAPI CallMapFunctionDb(HMAP hmap,TASKPARMEX * parm, char *path)

);

 {

  ...

 }

}

 

The variable hmap contains the identifier of the open map. The structure TASKPARM is described in the file maptype.h.

The constant tablename contains the full file name of the database table (dBase). During the macro operation, a temporary table is created that is not automatically deleted.

 

Standard type. To call a task in the module, a standard function declaration must be made:

extern "C"

{

long int _export WINAPI CallMapFunctionEx(HMAP hmap, TASKPARMEX * parm);

 {

  ...

 }

}

 

Applications tasks should be in DLL format.

 

The macro «Run application with parameters from the table» has the following properties:

- Exe file name - specifies the file name with the EXE extension, which is selected using the standard file selection dialog;

- Parameter field - specifies the name of the table field containing parameters for launching the application.

 

The macro «Run application» has the following properties:

- Application name - specifies the file name with the EXE extension, which is selected using the standard file selection dialog.

 

The macro «Plot point objects» has the following properties:

- Dataset - determines the reference to the «Table» (or «Query») component name, providing a link to a specific set of information from the database;

- Field with map name, X coordinate field, Y coordinate field, H coordinate field - contain the names of the corresponding table fields.

- Coordinate system - specifies the coordinate system and can take values: meters, degrees, radians.

- Establish connection - whether to establish a connection between the created object and its corresponding record in the database table or not. The established connection allows finding the corresponding object by record in the table during subsequent work with the database or vice versa.

 

The macro «Open URL» has the following properties:

- Dataset - determines the reference to the «Table» (or «Query») component name, providing a link to a specific set of information from the database;

- URL field - name of the table field containing URL addresses.

- URL address - a string containing a URL address.

 

The «Macro List» component operates in two modes (depending on the filled properties of the component):

- When properties «Dataset» and "URL field" are set, it navigates through links contained in the database table field;

- When the property «URL address» is set, it navigates through the link contained in the «URL address» component property.

 

The macro «Open data» has the following properties:

- Dataset - determines the reference to the data access component name (Table, Query, Parameterized query), providing a link to a specific set of information from the database.

 

The macro «Open map» has the following properties:

- Dataset - determines the reference to the «Table" (or «Query») component name, providing a link to a specific set of information from the database;

- Field with map name, X coordinate field, Y coordinate field - contain the names of the corresponding table fields.

- Coordinate system - specifies the coordinate system and can take values: meters, degrees, radians.

 

The macro «Open form from table» has the following properties:

- Field with form name - specifies the name of the table field containing the name of the user form in this project.

 

The macro «Report for DS» has the following properties:

- Template file name - specifies the name of the template file created and configured in advance in Microsoft Office.

 

Reports are created using Microsoft Office tools (for templates with the extension XLT - MS Excel, with the extension DOT - MS Word).  

The document template consists of a descriptive part that is not editable automatically and data fields (key fields) that are replaced with corresponding values from the table during the report creation process. Data fields represent table field names in the form of uppercase letters enclosed between "#" symbols. For example, NUMBER is the table field name, #NUMBER# is the data field name in the template.  

The report type indicates the type of report being created and can take values: Excel - report for all records (by default), Excel - report for the current record, Word - report for the current record, based on the template type.

 

Reports can be tabular or form-based.

A tabular report can only be created based on an MS Excel template and contains data in the form of a table. The first row of the report template where data printing as a table should start must list the data field names. An example is provided of a tabular report based on a template named ExExcel.xlt.  

 

A form-based report is a document where data field names are placed anywhere chosen by the user and can be repeated. A form-based report is created based on an MS Word or MS Excel template. An example is provided of a form-based report based on a template named ExWord.xlt.

 

The dataset determines the reference to the «Table» (or «Query») component name, providing a link to a specific set of information from the database.

 

The macro «Calculate on Map»  has the following properties:

- Dataset - determines the reference to the «Table» data access component name. The data table must be linked to the map.

- Field to store result - selects a field from the dataset fields list. The result of the calculation function will be stored in this field. The selected field type should match the calculation function type. For example, calculation function results like «Area» and «Length» are stored in String or Double fields, Classification code and Object number are stored in String or Integer fields, Name is stored in a String field.  

- Calculation function type - specifies the type of calculation function and can take values: length, classification code, name, object number, area.

 

The macro «Create Query» has the following properties:

- SQL query - determines the reference to the «Query» component name, establishing a connection to a specific set of information from the database.

 

The «Save a dataset to a File» macro has properties:

- Dataset - determines the reference to the «Table» (or «Query») component name, linking to a specific set of information from the database.

 

The macro «Create Filter» has the following properties:

- Form type for filter - specifies the form type of the applied filter and can take values: advanced template, simplified template. Searching records in the current data table is done by forming a text query by the user and filtering data according to the query. After executing the query, only records that meet the specified conditions will be available for viewing and editing.  

- Dataset - determines the reference to the «Table» (or «Query») component name, linking to a specific set of information from the database.

 

The macro «Save Query» has the following properties:

- Temporary table - determines the reference to a component of type «Save Query», which this macro executes.

 

The macro «Create Parameterized Query» has the following properties:

- Parameterized query - determines the reference to a component of type «Parameterized Query», enabling query parameter formation;

- Automatic execution - specifies whether to display an editing form for the generated query text («No») or execute the query automatically («Yes»).

 

The macro «Create a Parameterized Filter» has the following properties:

- Automatic execution - determines whether to display an editing form for the generated filter text («No») or apply the filter automatically («Yes»).

- Dataset - defines a reference to the data access component name (Table, Query, Parameterized Query), establishing a connection to a specific set of information from the database.

- Filter settings - contain the filter text. When using the «Parameterized Filter», the dataset is limited to records that satisfy the filter, which specifies the selection criteria for the records. The «Filter Editor» is used to create the filter, accessed through the property value field.

 

The «Editor» window is divided into four parts: the filter text, a list of dataset fields, a list of component names for entering values, and a list of component names for selecting logical operators. Hovering over each part of the «Editor» displays a tooltip indicating its purpose.

 

 

_bm3733

 

The macro «Create a parameterized filter». Editor window.

 

The filter expression is a construction that can include the following elements:

- table field names;

- literals;

- component names for entering values;

- comparison operations;

- logical operations;

- component names for selecting operators.

 

Comparison operations

 

Symbol

Decoding

=

equally

<

less

>

more

<=

less than and equal to

>=

greater than and equal to

<>

not equal to

 

Logical operations such as AND, OR, NOT can be used, or you can specify the component name to select logical operators. The component name for selecting logical operators should be enclosed in «#» symbols (for example, #Operator_Selection1#).

 

In the filter text, the field name and comparison operations should be separated by a space.

As examples of filter conditions for the table locality.dbf, the following expressions are provided:

[SEM9]  =  ' Aborino '  AND  [POSEL_ID] = 6

[SEM9]  = $'Input_Value1'$  #Operator_Selection1#  [POSEL_ID]=$Input_Value2$

 

The first expression selects all records where the values of the fields are explicitly specified: SEM9 equals 'Aborino' and the field POSEL_ID = 6. For the second expression, the field values are specified using the components 'Enter_value' and 'Select_operator'. When the filter is activated, the parameter name is replaced with a specific value from the corresponding form component.

To create the second expression, the user form must contain the components 'Enter_value' and 'Select_operator'. To create this expression in the «Editor», select the field name and «drag» it into the filter text window, then enter the comparison operation. Select and «drag» the component name for entering values, selecting operators, etc. The field name will be written without square brackets if you press the «Shift» key while dragging.

To activate and deactivate the filter, use the macro «Enable/Disable filtering».

 

Example of creating a userform using the «Macro List» component