Generating Form Files From Database Tables

--gen: Generating Forms From List of Arguments

--genconfig: Generating Forms From JSON File Data

Generation Preferences

qform is a command-line tool in Lycia that handles forms. One of its main usages is to transform classic and dynamic 4GL / BDS / PER forms to nativeLycia .fm2 XML forms. Another usage is to create forms automatically by specifying the database table name, output folder, form template file, output form file name, and fields of the table to use.

Note: Read more on this tool here: qform

To generate forms from existing database tables, you can:

--gen: Generating Forms From List of Arguments

qform -p "<output_dir>" --gen "{\"database\":\"cms_llc\",\"outputs\":[{\"output\":\"output_file_1.fm2\",\"template\":\"template_file.fm2\",\"primary_table\":\"activity\",\"generate\":[{\"container\":\"grid_panel_1\",\"fields\":[\"activity.activity_id\",\"activity.open_date\",\"activity.close_date\",\"company.comp_name\"]},{\"container\":\"grid_panel_2\",\"fields\":[\"activity.*\",\"company.*\"]}]},{\"output\":\"output_file_2.fm2\",\"generate\":[{\"container\":\"grid_panel_1\",\"fields\":[\"activity.activity_id\",\"activity.open_date\",\"activity.close_date\",\"company.comp_name\"]},{\"container\":\"grid_panel_2\",\"fields\":[\"activity.*\",\"company.*\"]}]}]}"

Code snippet 1: --gen usage example

-p "<output_dir>" - specifying the output path;

"template":"template_file.fm2" - specifying the template file for generated form (you can add separate templates for separate forms);

"primary_table":"activity" - the table to use (can be specified for each output form file separately);

"generate" - this argument precedes the list of containers and fields to add to the output form;

"container":"grid_panel_1" - setting a container for output form;

"fields":["activity.activity_id","activity.open_date","activity.close_date","company.comp_name"] - the array of fields to associate form fields with.

--genconfig: Generating Forms From JSON File Data

qform -p "<output_dir>" --genconfig <c:\configs\myconf.json>

Code snippet 2: --genconfig usage example

-p "<output_dir>" - specifying the output path;

<c:\configs\myconf.json> - providing the path and name for the JSON file that has the necessary data.

Generation Preferences

1. To generate a Table container, make a template form with Table container and provide its identifier to the qform.

2. To generate a Table container with specific table columns, make a template form with Table container. Add one TableColumn, add Control inside it with specific attributes, and provide the identifier of that Table to the qform. The generator will create TableColumns and copy all attributes from the template table column and its widget.

3. If you want to generate a GridPanel with specific number of columns with Label-Widget pairs, make a template form with GridPanel container, add as many Label-Widget pairs as you need to it, and add attributes. The Generator will treat one Label-Widget pair as one row, therefore it will create as many "rows" as you specify. All the attributes from template widgets will be copied to their instances. The Generator checks whether the template’s GridPanel is empty, then creates two columns of Label-Widget pairs. And if GridPanel or Table already has child widgets and TableColumns, the Generator will use them as a template for generated widgets. No matter what kind of widget you use as a template, it can be TextField or ComboBox, or any other: the Generator will use attributes from that widget only and will create an appropriate widget depending on the data type of the database table column.

The list of attributes that are copied from the template widget:

Return to top

 

See next: Record Data Validation and Manipulation

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.