Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Problem Statement


English

In this article, we will discuss how to create a new form by performing a lookup into the existing table inside the Joget database. If the existing table has a sizeable number of fields (ie. 50 fields), it would take some time to drag and drop each and every form element into a new form.

This is the sample table structure used in creating the demo app.


Code Block
languagesql
linenumberstrue
mysql> describe custom_table \G
*************************** 1. row ***************************
  Field: id
   Type: varchar(255)
   Null: NO
    Key: PRI
Default: NULL
  Extra: 
*************************** 2. row ***************************
  Field: name
   Type: varchar(255)
   Null: YES
    Key: 
Default: NULL
  Extra: 
*************************** 3. row ***************************
  Field: address
   Type: varchar(255)
   Null: YES
    Key: 
Default: NULL
  Extra: 
3 rows in set (0.00 sec)

mysql> 

...

  1. Key in the custom table name into the text field.
  2. Click Generate
    Image Modified
    Figure 1: Screenshot Showing Form Definition Generated from the Custom Table Name
  3. With the form definition generated, copy its content.
  4. Create a new form or open any existing form.

    Figure 2: Create New Form
  5. In the form builder, go to Form Builder > Advanced Tools > JSON Definition, paste the definition earlier, then click Update.

    Figure 3: Paste JSON Definition of the Form into Form Builder
  6. Verify the form design, then click Save.
    Image Modified
    Figure 4: Form Design from the Generate JSON Definition.

...

In line 19, you can modify the connection string if you need to perform the table lookup in another database other than the default one.

In line 27, you can modify to use other form element other than textfield depending on your needs.

Download Demo App

View file
nameAPP_generateFormDef-1-20211011154430.jwa
height250