In this tutorial, you will learn how to customize your display cards, forms, and collections in xDM to enhance the user experience of your employee application.
What you'll learn
Customizing display cards
Building forms for browsing and authoring data with different layouts
The estimated duration of this unit is about 2 hours.
Display cards define the visual representation of a record in a nicely formatted way. They appear in collections displayed as lists, tables or grids. They also appear in form headers or as chips to display a reference to a record.
In this first step, you will be guided to customize two different display cards.
What you'll learn
Enhancing the employee display card by adding pictures
Enhancing the department display card by adding an icon
Deploying and seeing your changes
Customize the Employee card
Let's now customize the Display Card of the Employee entity by adding a primary and a fallback image.
Open the HRTutorial model in the Application Builder.
Navigate to Entities>Employee > Display Cards in the Model Design View and open the EmployeeDisplayCard.
In the Image section of the editor, select SemQL in the value type drop down of the Primary Image property.
Enter the following values:
Primary Image: Picture
Primary Image Source: Content
Primary Image Resize Mode: Fill
Click the Select Image button next to the Fallback Image property.
Search for view-profile and select the image returned.
Go to the Avatar section, select SemQL in the value type drop down of the Avatar property.
Enter the following values:
Avatar: Picture
Avatar Source: Content
Avatar Resize Mode: Fill
Save your work.
Add more cosmetic elements
Let's adapt the EmployeeCollection and then add an icon to the department display card from the image library.
Under the Employee entity, expand the Collections node and double-click EmployeeCollection.
Select the Overview tab.
In the List section, select Show Avatar.
In the Grid section, select Allow Grid.
Save your work.
Go to Entities > Department > Display Cards and then double-click DepartmentDisplayCard.
In the Avatar section, click the Select Image button next to the Avatar property.
Search for domain.svg and select the image returned.
Save your work.
Refresh and see the results
As you did not change any rules in your model besides the display card images, you do not need to re-deploy your model but only need to refresh your application.
Go to your Employee Tutorial application, open the user menu on the top-right corner, and then select Refresh Application.
Go to the Department business view and notice that departments now have an avatar icon.
Select the Employee business view and sort records by First Name.
Select the following employees by clicking on their avatar and then select Edit in the Action menu:
Alexis Bull
Alyssa Hutton
Amit Banda
Scroll down until the end of the form and click the BROWSE button.
Select the picture data-authoring\employees\alyssa.png from the tutorial resources and then click EDIT NEXT.
Repeat the same process for the other two employees, and then click GO TO LIST:
For Amit Banda, select the amit.png file.
For Alexis Bull, select the alexis.png file.
Click FINISH.
When the toaster indicates "Changes successfully applied", select CLICK TO REFRESH.
See how the pictures that you have uploaded are now displayed as avatars.
Select List view from the actions menu to switch the type of view of the Employees collection.
Switch view again by selecting Grid view from the actions menu.
Select Table view from the actions menu to switch back to the default view.
Congratulations
You have enhanced the user experience by customizing Display Cards.
What we've covered
You enhanced the department Display Card by adding an icon.
You enhanced the employee Display Card by adding pictures.
You deployed and saw your changes in action.
Now is the time to get to more advanced features: let's build beautiful forms!
It is a best practice to separate data authoring forms from browsing forms.
When browsing data, there is a lot of obvious information (such as labels) that can be hidden, and other information that should be highlighted using a different typography or color. You may also use computed fields in data browsing forms.
In this step, you will create a nice looking employee browsing form. You will be using SemQL to format relevant employee attributes and display meaningful data to the business users.
For example, instead of displaying the HireDate as-is, you will rather define a Hired expression with the following format: Since 28-Feb-2018.
As you will learn later, you can also use SemQL expressions and conditions to format your results. For example, you might want to hide a field depending on the value of another field, or change the color of a field value depending on a complex condition.
What you'll learn
How to structure a form
How to use SemQL expressions to format data
How to associate your newly created browsing form to a business view
Create the form and the structure
You will start this series of steps by creating a new form and its structure (tabs and containers).
In the Application Builder, right-click the Forms node under the Employee entity, and select Add Form.
Set the Name to EmployeeBrowsingForm and click Finish.
In the EmployeeBrowsingForm editor, select the FormTab: General element in the tree view, and then enter the following values in the Property Inspector:
Name: General
Label: General
Click the Select Image button next to the Icon property.
Search for account-circle.svg and select the image returned.
Set the Display As property to Icon and Label.
Add a second tab by dragging and dropping the Add Form Tab button under the General tab, and then rename it to Contact.
Click the Select Image button next to the Icon property in the General section of the Properties view.
Search for cellphone-link.svg and select the image returned.
Set the Display As property to Icon and Label.
Add two nested containers in the General tab by dragging and dropping the Add Form Container button as shown below:
Select the second container and then enter the following values in the Properties view:
Layout Direction: Vertical
Relative Width: 20
Add a second nested container into the parent container by dragging and dropping the Add Form Container button as shown below:
Select the second nested container that you just added. In the Properties view, set the Layout Direction to Vertical.
Save your work.
Configure the form fields
Add the Picture field
Under the Entities > Employee > Forms node, open the EmployeeBrowsingForm form.
Drag and drop the Picture attribute into the first vertical container as shown below:
In the General section of the Properties view, set the Component Type property to Image.
In the Component section of the Properties view, enter the following values:
In the General section of the Properties view, enter the following values:
Select Use Custom Label
Label: Name of employee
Documentation: with salutations...
In the Component section, set the Typography to title.
In the Label section, unselect Visible.
Save your work.
Add the Title field
Drag and drop the Title attribute after the Name field as shown below:
Enter the following values in the General section of the Properties view:
Select Use Custom Label
Label: Title
Documentation: Employee title as it appears in the HR system
In the Component section, set the Typography to subhead.
In the Label tab, unselect Visible.
Save your work.
Add the Subsidiary field
Drag and drop the Subsidiary attribute after the Title field.
Enter the following values in the General section of the Properties view:
Select Use Custom Label
Label: Subsidiary
Documentation: Subsidiary to which this employee reports
In the Component section, set the Typography to subhead.
In the Label section, unselect Visible.
Save your work.
Add the Department field
Drag and drop the FDN_Department attribute after the Subsidiary field.
In the General section, enter the following values:
Select Use Custom Label
Label: Department
Documentation: Department to which this employee reports. See Departments
In the Component section, enter the following values:
Display Type: chip
Select Avatar
In the Label section, unselect the Visible option.
Save your work.
Add the IsContractor field
Drag and drop the Add Form Field button after the Department field.
Double-click the Name column in the tree view for the new FormField and rename it to Contractor.
Select the Value cell and then click the Edit Expression button.
Enter the following expression in the SemQL Editor and then click OK:
case when IsContractor = '1' then 'Contractor' else 'Employee' end
Enter the following values in the General section of the Properties view:
Select Use Custom Label
Label: Contractor
Documentation: Indicates whether the person is an employee or a contractor
In the Component section, select SemQL in the value type drop down of the Text Color property, and then click the Edit button to open the SemQL Editor.
Enter the following expression in the SemQL Editor and then click OK:
case
when IsContractor = '1' then 'md:orange'
else 'md:green'
end
In the Label section, unselect Visible.
Save your work.
Add the Hired field
Drag and drop the Add Form Field button after the Contractor field.
Set the Name to Hired, select the Value cell, and then click the Edit Expression button.
Enter the following expression in the SemQL Editor and select OK:
In the General section, enter the following values:
Select Use Custom Label
Label: Ended
Documentation: Date of contract termination
Select SemQL in the value type drop down of the Visible property, and then click the Edit button to open the SemQL Editor.
Enter the following expression in the SemQL Editor and then click OK:
EndDate is not null
In the Component section, set the Text Color to md:red.
In the Label section, unselect Visible.
Save your work.
Add the Employee ID field
Drag and drop the Add Form Field button into the second vertical container.
Set the Name to ID, select the Value cell, and then click the Edit Expression button.
Enter the following expression in the SemQL Editor and select OK:
LPAD(SEM_TO_CHAR(ID), 6 , '0')
In the General section, enter the following values:
Select Use Custom Label
Label: Employee ID
Documentation: Unique employee ID in the company
In the Component section, enter the following values:
Text Color: md:grey
Typography: caption
In the Label section, unselect Visible.
Save your work.
Add the Phone field
Drag and drop the Phone attribute into the Contact form tab.
In the Label section of the Properties view, set the Icon property to images://mdi/cellphone.svg.
Add the Phone Status field
Drag and drop the Add Form Field button into the Contact form tab, after the Phone field.
Set the Name to PhoneStatus. Select the Value cell, and then click Edit Expression.
Enter the following expression in the SemQL Editor and then click OK:
case
when Phone is null then 'No phone.'
when Phone is not null
and EnrichedPhone.IsPossible is null then 'Phone not verified yet.'
else
SEM_CONCAT(' • ', '1', EnrichedPhone.EnrichedPhone, EnrichedPhone.Country, EnrichedPhone.LineType, EnrichedPhone.Location)
end
In the General section, enter the following values:
Select Use Custom Label
Label: Phone Status
Documentation: Description of the validity of a phone number
In the Component section, select SemQL in the value type drop down of the Text Color property, and then click the Edit button to open the SemQL Editor. Enter the following expression and then click OK:
case
when EnrichedPhone.IsPossible = '1' then 'md:grey'
when EnrichedPhone.IsPossible is null then 'md:orange'
else 'md:red'
end
Set the Typography property to caption.
In the Label section, unselect Visible.
Add the Email field
Drag and drop the Email attribute into the Contact form tab, after the Phone Status field.
Select the Value cell in the tree view, and then click the Edit Expression button. Enter the following expression in the SemQL Editor and then click OK:
SEM_CONCAT('', '1', 'mailto:', Email)
In the General section, enter the following values:
Select Use Custom Label
Label: Email
Documentation: Hyperlink to email
Component Type: Hyperlink.
In the Component section, select SemQL in the value type drop down of the Display Text property, and then click the Edit button to open the SemQL Editor.
Enter the following value in the SemQL Editor and then click OK:
Email
In the Label section, set the Icon to images://mdi/email.svg.
Save your work.
Activate the browsing form
In the Application Builder, navigate to Entities > Employee > Business Views, and double-click the Employee Business View.
In the Transitions section, select EmployeeEO.
In the Display Properties, click the Select a value... button next to the Browsing Form property.
Select the EmployeeBrowsingForm and then click OK.
Save your work.
Validate your model: right-click the root node in the Model Design View - element HRTutorial [0.0] and select Validate. No error should be returned.
See the browsing form in action
Go back to the Welcome Page and open the Employee Tutorial application.
Open the user menu and select Refresh application.
Select Employees in the Navigation Drawer, click the Alexis Bull record to see the new browsing form.
Browse the employees Jack Livingston and Julie Nayer to see how the user interface adapts.
Congratulations
You have successfully completed the second step of this tutorial by creating a browsing form for your Employee entity.
What we've covered
Creating a form with several containers and custom fields
Using SemQL expressions to format data
Associating your new browsing form to a business view
The next step will focus on creating an authoring form that will differ from the browsing form.
Data authoring forms should be optimized for the best user experience when entering data in steppers. Layout, field positions and formatting can differ from the browsing experience.
In this step, you will enhance the Employee authoring form.
What you'll learn
How to create an optimized employee authoring form
How to plug this form into your authoring stepper
How to use two different forms for authoring and browsing
Modify the existing form
Now that you know how to build a form, let's edit the EmployeeForm that you generated with the Generate Application Components wizard and enhance it.
Create the structure
You will now add containers to the default form.
In the Application Builder, go to Entities > Employee > Forms entity, and double-click EmployeeForm.
Select all attributes (hold Shift and select the first and last attribute in the tree view) and click the Delete Selection button.
Click OK on the confirmation popup.
Select the EmployeeTab and set the following values in the Properties view (you can also double-click the Name and Label cells within the tree view to edit them):
Name: ContactInfo
Label: Contact Info
Drag and drop the Add Form Tab button after the ContactInfo Form Tab and set the Name to HR.
Drag and drop the Form container button into the ContactInfo tab, and repeat this operation twice to create three nested Form Containers within the first one.
Select the three nested containers: select the first container, press and hold the Shift key, and then select the third container.
In the General section of the Properties view, set the Layout Direction to Vertical.
Drag and drop one Form Container into the HR tab and create two nested Form Containers.
Set the Layout Direction to Vertical in the General section of the Properties view for these 2 nested containers.
Contact Info - First column
Drag and drop the FirstName attribute from the Attributes list into the first nested Container of the ContactInfo tab.
Select the FirstName form field and then enter the following values in the Properties view:
Helper Text: As it appears on the photo ID provided by the employee
Select Use Floating Label.
Drag and drop the LastName attribute into the same container, after the FirstName form field.
Select this field and then select Use Floating Label in the Label section of the Properties view.
Drag and drop the Salutation and Subsidiary attributes after LastName.
Contact Info - Second column
Drag and drop the IsContractor attribute into the second nested Form Container of the ContactInfo tab.
Drag and drop a Form Container just after the field IsContractor, and drag and drop the Phone attribute into this container.
Select the Phone field and enter the following values in the General section of the Properties view:
Select Use Custom Label
Label: Phone (and country code)
In the Component section, set the Relative Width to 70.
In the Label section, select Use Floating Label.
Drag and drop the EnrichedPhone.Country attribute (from the complex attribute EnrichedPhone) after the Phone field.
Select the EnrichedPhone_Country field and then enter the following values in the General section of the Properties view:
Select Use Custom Label
Label: Code
In the Label section, select the Use Floating Label option.
Drag and drop a Form Field into the second vertical form container. It is automatically inserted after the container that holds the Phone and EnrichedPhone_Country fields. Set the Name of this Form Field to PhoneStatus.
Click the Edit Expression button in the Value cell of the PhoneStatus field.
Enter the following expression in the SemQL Editor and then select OK:
case
when Phone is null then 'No phone.'
when Phone is not null
and EnrichedPhone.IsPossible is null then 'Phone not verified yet.'
else
SEM_CONCAT(' • ', '1', EnrichedPhone.EnrichedPhone, EnrichedPhone.Country, EnrichedPhone.LineType, EnrichedPhone.Location)
end
In the Component section, enter the following values:
Text Color: md:grey
Typography: caption
Unselect Visible in the Label section of the Properties view.
Drag and drop the Email attribute below the PhoneStatus field.
Select the Email field. In the General section of the Properties view, set the Helper Text to Note: email is mandatory for contractors.
In the Label section, select Use Floating Label.
Contact Info - Third column
Drag and drop the ID attribute into the third nested container.
Click the Edit Expression button in the Value cell of the ID field.
Enter the following expression in the SemQL Editor and then select OK:
LPAD(SEM_TO_CHAR(ID), 6 , '0')
Enter the following values in the General section of the Properties view:
Select Use Custom Label
Label: Employee ID
Drag and drop the Picture attribute after the ID field.
Select the Picture Form Field and then set Component Type to Image in the Properties view.
In the Component section, set the following properties:
Image Source: content.
Height: 250.
Review your Contact Info tab. It should look as shown below:
HR - First column
Drag and drop the FDN_Department attribute into the first container of the HR form tab.
Select this Form Field and then enter the following values in the Component section of the Properties view:
Display Type: Chip
Select Avatar
Select Secondary Text
Drag and drop the Title attribute after the Department field.
Select the Title form Field. In the Label section of the Properties view, unselect Use Floating Label.
HR - Second column
Drag and drop the HireDate attribute into the second container of the HR form tab.
Drag and drop the EndDate attribute after the HireDate field.
Save your work.
Plug your form
Because you modified the default authoring form that was previously used by the AuthorEmployees stepper, you need to adapt this stepper to the new tab structure and make it a 2-step stepper.
In the Application Builder, expand the Steppers node under the Employee entity, and then double-click AuthorEmployees.
In the Steps tree table, select the second line. Enter the following values in the General section of the Properties view:
Name: ContactInfo
Label: Contact
In the Form Enrichers tab, unselect On Form Open for the DefaultHireDate enricher. This enricher will be triggered on the second step (HR tab).
Select the first line of the table in the Steps section and click the Add Form Step button.
In the dialog, select the EmployeeForm > HR form tab and then click Finish.
Select again the step ContactInfo in the Steps table and then select the Step Transition Validations tab of the Property Editor. Select the following lines (hold Ctrl and then select items one by one), right-click the selection, and then select Skip:
CheckEndDate | CHECK
Department | FOREIGN
Department | MANDATORY
HireDate | MANDATORY
In the Form Validations tab, unselect On Data Change for the following validation rules:
CheckEndDate | CHECK
Department | FOREIGN
Department | MANDATORY
HireDate | MANDATORY
Still in the Form Validations tab, unselect On Form Open for the following validation rules:
Department | MANDATORY
HireDate | MANDATORY
Select the HR step and, in the Form Enrichers tab, select On Form Open for the DefaultHireDate enricher.
In the Step Transition Validations tab, select the following lines, right-click the selection, and then select Block:
CheckEndDate - CHECK
Department - FOREIGN
Department - MANDATORY
HireDate - MANDATORY
In the Form Validations tab, select On Data Change for the following validation rules:
CheckEndDate - CHECK
Department - FOREIGN
Department - MANDATORY
HireDate - MANDATORY
Still in the Form Validations tab, check On Form Open for the following validation rules:
Department - MANDATORY
HireDate - MANDATORY
Save your work.
Deploy your changes
In the Application Builder, right-click the root node in the Model Design View, corresponding to the HRTutorial [0.0] model, and then select Validate. No errors should be displayed.
Go to the Management perspective of the Application Builder, right-click the EmployeeTutorial, and then select Deploy Model Edition.
In the dialog, click Finish to deploy your updated model.
See the authoring form in action
Good job! The application is deployed and ready to use. Let's create an employee to see the new authoring form.
Connect to the Employee Tutorial application, select the Employees business view in the Navigation Drawer.
Open the actions menu and select Create.
Notice the following:
The authoring experience is now split in 2 steps: Contact and HR.
The 3-columns layout makes the form user-friendly.
The validations and enrichers apply as per the stepper's configuration.
Enter the following values in the Contact tab then select NEXT:
First Name: Dimitry
Last Name: Pavlov
Salutation: Mr
Subsidiary: ACME_EU
Phone: 4959371500
Phone Country: RU
Picture: browse and select the file data-authoring\employees\dimitri.png from the tutorial resources.
Enter the following values in the HR tab then select FINISH:
Department: Consulting
Title: Semarchy Champion
Search for the record you just created: click the Filter button above the Employees collection and enter pavlov in the Search Text field.
Click the record to open it.
Open the actions menu on the top right corner of the browsing form and select Edit.
Enter the following values in the Contact tab then select NEXT:
Select Is Contractor
Email: dimi@acme-eu.com
Leave the HR tab as it is and select FINISH.
Wait until the toaster at the bottom-left corner of the screen indicates "Changes successfully applied", and then select CLICK TO REFRESH:
See the changes on both tabs of the browsing form.
Congratulations
You have successfully completed the third step of this tutorial by customizing the authoring form for your Employee entity.
What we've covered
Configuring a form with several containers and custom fields
Creating a two-step stepper to author employees
Using two different forms for authoring and browsing
The next step will focus on customizing a collection view.
Collections display a set of records in a table, a list, or a grid. You control which of these view types are available for business users.
Collections are composed of table columns, similar to form fields. You can customize which columns will be available to users, visible or hidden by default.
The next steps will guide you to customize the employee collection view as depicted here.
What you'll learn
Adding table columns to customize a collection view
Using SemQL expressions to format data
Modify the Employee collection
Building a collection is simpler than a form: collection columns have nearly the same set of properties as the form attributes, but collections have a much simpler layout.
In the Design perspective of the Application Builder, go to Entities > Employee > Collections and then double-click EmployeeCollection. the
Select the ID column and then set the following properties in the Column section of the Properties view:
Display Format: 000000
Column Alignment: Right
Drag and drop the Add Table Column button between the ID and FirstName fields. Enter the following values:
Name: Type
Label: Type
Click the Edit Expression button in the Value cell.
Replace the existing value with the following expression in the SemQL Editor and then click OK:
case
when IsContractor = '1' then 'Contractor'
else 'Employee'
end ||
case
when EndDate is not null then ' (inactive)'
else ''
end
In the Column section of the Properties view, select SemQL in the value type drop down of the Color property, and then click the Edit button to open the SemQL Editor.
Enter the following expression in the SemQL Editor and then click OK:
case
when EndDate is not null then 'md:grey'
when IsContractor = '1' then 'md:orange'
else 'md:green'
end
Select the FirstName column in the collection editor and then unselect Visible By Default in the General section of the Properties view.
Repeat the same operation for the following fields:
LastName
Subsidiary
Title
Drag and drop the existing FDN_Department column between Title and HireDate.
Enter the following values in the Component section of the Properties view:
Display Type: chip
Select Avatar
Drag and drop the Add Table Column button between the FDN_Department and HireDate fields. Enter the following values:
Name: VerifiedPhone
Label: Phone (verified)
Click the Edit Expression button to open the SemQL editor.
Replace the existing value with the following expression in the SemQL Editor and then click OK:
case
when Phone is not null then
case
when EnrichedPhone.EnrichedPhone is null then SEM_CONCAT('', '1', Phone, ' (?)')
when EnrichedPhone.IsValid = '1' then
SEM_CONCAT('', '1', EnrichedPhone.EnrichedPhone, ' (✓)')
when EnrichedPhone.IsValid = '0' then
SEM_CONCAT('', '1', EnrichedPhone.EnrichedPhone, ' (!)')
else ''
end
else ''
end
Drag and drop the existing Email column between VerifiedPhone and HireDate and then set the Label to Email.
Click the Edit Expression button in the Value cell to open the SemQL editor.
Replace the existing value with the following expression in the SemQL Editor and then click OK:
SEM_CONCAT('', '1', 'mailto:', Email)
In the General section of the Properties view, set the Component Type to Hyperlink.
In the Component section, select SemQL in the value type drop down of the Display Text property, and then set the Display Text to Email.
Drag and drop the Picture column between EndDate and IsContractor.
Enter the following values in the Component section of the Properties view:
Display Text: View Picture
Link Source: content
Open In: popup-image
Select the IsContractor column in the tree view, press and hold the Shift key, and then select the Phone column. In the Properties view, unselect Visible By Default.
Save your work.
See the collection view in action
As you didn't change any rules besides the collection layout, you do not need to re-deploy the model but only need to refresh your application.
On the Welcome Page, open your Employee Tutorial application and select Refresh application from the user menu.
Select Employees in the Navigation Drawer.
Notice the following enhancements of the new collection view:
The ID is formatted with 6 numbers.
The employee type is more meaningful to business users.
Phone numbers show their status.
Email addresses appear as hyperlinks.
Pictures appear as hyperlinks.
Open the actions menu and select Select columns.
Drag and drop the Title column between Title and Department, select the checkbox next to it to make it visible, and then click APPLY.
The collection now shows the column you just added.
Congratulations
You have successfully completed the fourth and last step of this tutorial by customizing the collection view for your Employee entity.
What we've covered
Adding table columns to customize a collection view
Using SemQL expressions to format data
Excellent job following this tutorial! With this unit, you learned how to customize the user interface with display cards, forms, and collections within your first data authoring application.
What we've covered
Display Cards: You modified your display cards and added images.
Forms: You created optimized browsing and authoring forms.
Collections: You enhanced your collections with formatted data and colors.
UX: In short, you have greatly contributed to a better user experience.
What's next?
In the next unit, you will learn how to customize your business views and hierarchies to provide a better navigation experience to your business users.