Database table with Data+ Forms create db entry v2.4.0
This example will use a combination of the Data+ Table and Data+ Forms to create a simple database table view with a more customizable create db entry dialog.
- Our database table (columns: user,customer,article,count,fullfilled)
LIB CONNECT TO 'Data+ Server';
LOAD id,
user,
customer,
article,
count,
fullfilled;
[orders]:
SELECT "id",
"user",
"customer",
"article",
"count",
"fullfilled"
FROM "public"."orders";
-
Setup our Data+ Table
the row identifier is the id of the table. This will give us a direct representation of the database. Once we created a new db entry, a reload will be triggered and the new entry will show up here.
-
The next step will be to setup the Forms extension, we won’t go into detail on how to create the form, in the end we want some input fields for the customer, article and count. The user will be filled automatically. The article list is available in the data model. It can look like this:
-
Furthermore add an task reload action to reload the app when a
Forms
entry has been made -
Once
Data+ Forms
is configured, we can set it in dialog mode, adjust the dialog size and put it on some free space of the sheet (it will not be visible by default) -
Now we need a button to let the user open the
Forms
dialog. This can be done with the MultiUseButton, Data+ Process Chain or (in our case)Data+ Table
-
First we will add a custom button:
Appearance -> Data+ -> Table styling -> Info bar -> Custom buttons -
We want to simplify the saving process, so we enable
save on entry
(Settings -> General -> Save on entry) -
Next we add an action to the custom button.
Open the rule editor and create a rule with theCustom button
trigger -
Add the rule action
Send Data+ message
and select the target and Function, it should look like this -
If we click the button now, the
Forms
dialog should open and we can enter our order -
After saving the order, a reload should be triggered and we can see the order in the table
-
We now have a list of orders that can be sorted,filtered or marked as fullfilled with a single click