Custom Sentence
Custom sentence is a type of a derived field that allows you to configure content that changes dynamically according to the data.
With custom sentence, you can create a custom description for a Calendar event, send custom notifications on Slack, open a task on Asana or send Custom SMS. In short, possibilities are unlimited with custom sentence.
How to Create & Use Custom Sentence?
We have created a use case for displaying company details, where content stays the same but company details changes with the help of custom sentence.
We have covered both the configuration as well as the execution part below.
Custom Sentence Configuration
Let's start by configuring the custom sentence derived field in the collection whose data you want to display dynamically using the custom sentence derived field. Then create a derived field in it with method type, Custom Sentence.
1. Open the Collection Settings
Go to the collections panel and open the settings of the collection in which you want to add a derived field for Custom Sentence.
2. Go to Derived Field
Once you open the settings of the collection, go to the menu tabs and click on Derived Fields to open it.
3. Name the Derived Field
After opening the derived fields tab, adding the name of the derived field is the foremost step. So, type a name of your choice and then proceed to the next step.
4. Select the Method Type
The option of Method Type contains all the permutations you can use to create a derived field. Select Custom Sentence as the method type.
5. Add the Custom Sentence
Type your Custom Sentence and click the Create button. The format of the custom sentence is simple. You just have to type what you want and keep the collection fields in the double curly brackets. Also, pick the name of the field from the backend which will open after clicking the eye icon on collection data page.
Remember, you can add multiple custom sentences in a collection. We have created two in the example shown.
Custom Sentence 01: The first custom sentence is created to show companies' names on their respective detail pages as the heading. So, the format of this custom sentence will be: {{name}}
- Custom Sentence 02: The second custom sentence is created to show companies' descriptions on their respective detail pages. So, the format of this custom sentence will be:
{{name}} is a private company that was incorporated on {{date_of_incorporation}}. It has share capital of {{share_capital}} and paid capital of {{paid_capital}}. It is a {{industry_type}} company with employee strength around {{total_employees}}.
Create the Page Workflow
The use case that we have shown involves two pages: List Page & Details Page
The List Page contains the data group that will display all the company names and a link that will redirect the users to a company's details page.
1. Link the Details Page to the List Page
To redirect users to a company's details page, a link component is added inside the data group which is bound to the details page.
If you are creating a page link, do not forget to select Parent Component Collection in the field, Get Path Link ID.
2. Bind the Collection to the Details Page
Open the settings of the details page and bind the collection in which you have created the custom sentence derived field.
It is an important step as it will make the custom sentence derived fields to appear in the settings of the component added in the page.
3. Bind the Custom Sentence
Drop a component in which you want to display the custom sentence derived field. Then open its settings and select the radio button, Get Text from Collection. An input bar will appear. Choose the custom sentence that you had created.
Custom Sentence 01: The custom sentence for company name is bound to a header in the details page.
Custom Sentence 02: The custom sentence for company description is bound to a paragraph in the details page.
Execution/Outcome
Once done, open the homepage in the preview or publish mode. Click the link and you will be redirected to the details page.
Company 01: The "Know More" link redirects you to the details page of ABC Limited which displays the company name and the company description coming via custom sentence.
Company 02: The "Know More" link redirects you to the details page of Vision Corporation which displays the company name and the company description coming via custom sentence.