Hi there AppWorks fans,
Welcome to a new installment of AppWorks tips.
In this short post we cover a nice feature that makes it possible to add keywords/labels to your entity with a nice searchable view like this on your form:
But how do we create such a component on our form?
Let get right into it…
And let me explain step by step…
Start by creating two entities….duh!…You probably know by now how to do this and otherwise you can use the search to find out.
I start with a new clean and empty ‘category’ entity.
And I also have a clean and empty ‘task’ entity available.
First create one property with the name ‘cat_name’ to the ‘category’ entity.
Make sure it’s of type ‘Text’ as it must be a ‘searchable’ property what we’ll see later. ‘Text’ is by default searchable!
Then create the 2 basic forms. The ‘Create’ and the ‘Default’ with this property applied on it. So you can create new categories…that’s all!
Oh yeah…and add a list building block to view ‘All categories’ as we need it later!
Save the entity, publish it and check if you can create new instances of the ‘category’ entity.
Next step…add a relationship building block to the ‘task’ entity with the name ‘ToManyCategory’
Don’t enable that bidirectional option; also not from the ‘category’ to the ‘task’ with a ‘ToOneTask’ relation as this labeling feature will not work on bidirectional relations!
Create those 2 basic forms to create and view this entity.
For the ‘Create’ form we drag & drop the ‘ToManyCategory’ on to it with this result:
Now we update this last added group component with the next settings:
- Type: Multiselect (if you don’t see this option you have created a bidirectional relation!)
- Mark: Enable autosuggest (available once you changed the type!)
- Browse list: All categories (it’s the list we created for the ‘category’ entity)
- Property: Name (it’s our ‘searchable’ and ‘Text’ typed property from our category)
The end-result looks like this:
Once you have this result: Save, publish and test…
When you create a new instance of the ‘Task’ entity in runtime you should be able to see something like this where you can start typing and the ‘autosuggest’ will give you back the selectable results list.
And that’s what brings us to the end of this quick post…I say “DONE”! We learned about a small tiny feature that can enhance your form with labeling or keywords functionality and now you also know how to do it! Have a great day and I see you in the next one…