Designing an App in Kodall must take into account at least two perspectives, one is the business problem and the other is the technical problem.
This lesson makes no exception so here are the two:
This App implements the management of a list of products with capabilites for searching and editing.
This App implements a data model, search views, edit views, menus.
The first step in designing a Kodall app is constructing the data model. The data model consists of entities, properties and relationships between entities.
For the purpose of this lesson we will create an app that manages a list of products. Each product must have a name, a price, and a bar_code.
Currently, the ER diagram will look like this:
We will create one entity:
Click the Develop app, and then click on the Customization sets menu.
In the page that opens, click the Add button located above the list.
In the page that opens, under the Edit section, fill in the Name of the customization set (e.g., products).
Select the Entities tab, click the Add button, and fill in the entity name: product.
Select the Properties tab, click the Add button for each property, and specify the Entity name, Property name, and Property type:
| Entity name | Property name | Property type |
|---|---|---|
| product | name | string |
| product | price | decimal |
| product | bar_code | string |
Click the Save button.
After the previous state the entities are saved as a draft, in order to be able to use them they need to be published as database tables. To publish the entities:
If you are not already in the Customization sets menu, click the Develop app, and then click on the Customization sets menu.
Select the row containing the products customization set.
Click the Publish button located above the list, next to the Add, Edit, and Delete buttons.
The views help the user interact with the entities, in Kodall there are two main types of views:
For this example we will first create a search view for the products.
Click the Develop app, and then click on the Search views menu.
In the page that opens, click the Add button located above the list.
Under the Search section, fill in the following fields:
Select the Filters tab, click the Add button, and enter the following filter configuration:
| Title | Argument name | Input type | Operator | Property name |
|---|---|---|---|---|
| Name | nameArg | String | IsLike | name |
Select the Fetch tab, and enter the following query:
FETCH product (key, name, price, bar_code) FILTER AND (${nameArg})
Click the Execute button to test the query, then click the Save button.
Click the Develop app, and then click on the Edit views menu.
In the page that opens, click the Add button located above the list.
Under the Editor section, fill in the following fields:
.productEditor (Note: if the name starts with a dot, the editor will be rendered as a dialog; otherwise, it is a page)productNew productProductEdit productSelect the Inputs tab, click the Add button, and enter the input configurations:
| Title | Property name | Input type |
|---|---|---|
| Name | name | String |
| Price | price | Decimal |
| Bar Code | bar_code | String |
Click the Save button.
Click the Develop app, and then click on the Search views menu. Select the row containing the Products search view (with name productSearch) and click the Edit button.
Under the Search section, set the Edit view field to .productEditor (select it from the autocomplete list as you type).
Click the Save button.
Now that you have created the data model and the views you can use them to create the app.
Click the Develop app, and then click on the Menus menu.
In the page that opens, click the Add button located above the list.
Under the Edit menu section, fill in the following fields:
Inventoryinventory#009933YesClick the Add button located above the list and enter:
| Name | Node item key |
|---|---|
| Products | #search\$productSearch |
Click the Save button.
Click the Reload button on your browser. In the upper right corner of the screen, you should see the Inventory app icon.
Click the Inventory app, and you should see the Products menu.
Now you should be able to search, add, edit, and delete products.