Before you begin
Review the following information before creating a template to display query data:
- The maximum number of results to display is 120.
- Use the ContactProfileImage business object to display profile pictures.
- If a source is removed from the query and one of the source’s properties is being used in the Template, the property is not automatically deleted from the Template content and must be manually deleted.
- Properties that use the built-in functions (Count, Max, Min, Avg, Sum) are respected, and the resulting values are displayed in the template.
- The following are currently not supported in the Query Template Display:
- Subtotal properties
- Optional query filters
- Exporting the query results directly from this iPart
Using placeholders in the Template tab
Placeholders can be used to populate attributes within HTML tags, such as the src attribute of <img> and <a> tags. Placeholders are specified using { } notation. For example:
{datasource[.property... ] [attributes]}
The {#...}
placeholder embeds data into the content or title at the placeholder location. The placeholder consists of the following components:
- datasource - The name of the data source.
- property - (optional) The name of the property. Can be chained together using dot notation. For example, prop1.prop2.prop3. Where the property is a collection, a specific item can be accessed using [i] notation. For example, .Address[1] would return the item at index position 1 from the Address collection.
- attributes - (optional) A space delimited set of attributes, some of which require values. Multiple attributes can be specified:
- uppercase - Convert the data to uppercase.
- lowercase - Convert the data to lowercase.
- format - Format non-string values, such as format="d".
- noencode - By default, inserted properties are HTML-encoded. This means that any HTML characters in your properties are rendered as plain text. Use the noencode attribute to ensure HTML markup is rendered in the browser.
Example: <strong>{#Party.FirstName noencode}</strong>
Creating and displaying the template
Create the query using the Template tab in IQA, then display the template using the Query Template Display content item.
Do the following to create the query:
- Go to RiSE > Intelligent Query Architect > New > Query.
- Name the query, then click the Sources tab.
- Create the query. The properties selected on the Display tab are the only properties available through the Template tab.
- Click the Template tab.
- Use the Insert data source field drop-down to begin adding the query display properties necessary in the template.
- Use the HTML tab to insert custom CSS or HTML to format the template data.
- When the template data is ready, Save the query.
Note: The Template tab accepts bootstrap card containers. See Cards Bootstrap for more information.
Note: See Displaying profile pictures in a query Template for details.
Do the following to display the query template:
- Create a new content record or open an existing content record (RiSE > Page Builder > Manage content).
- Select Add content, then open the Utility folder.
- Add the Query Template Display content item to the content record.
- Configure the content item:
- Limit users who can view data for other contacts - (enabled by default) If this option is enabled, only authorized users can view information for contacts other than themselves. This prevents other users from changing the ID in the URL to access another contact's data. Authorized users include staff and Company Administrators for a group that the contact belongs to. Disable this option to allow all users to view information for other contacts, such as for a public profile. If this option is disabled, the system security settings determine whether a user must be logged in to view information for other contacts.
- Source query – Click select and browse to the IQA query. The query must have content defined in the Template tab of the query definition.
- Display in cards – Displays the query content in a container that resembles a card. See the Cards Bootstrap documentation for more information about cards. When this option is not enabled, the query content is displayed in a simple list.
- Display in columns - Displays the information in multiple columns instead of a single column.
- Number of columns – Select the number of card columns to display on each page.
- Rows per page – Enter the number of data rows to display on each page.
- Pager position – The pager is a set of controls that moves the pages of results either forward or backward. Select where the pager is located:
- Left - Select to show paging controls on the bottom left of the page.
- Center - Select to show paging controls in the bottom center of the page.
- Right - Select to show paging controls at the bottom right of the page.
- Use simple pager - Enable to hide the page numbers.
- Hide when there are no results – Enable this option to hide the content item when the query specified returns no results.
- No results tab – Message displayed when the query specified returns no results. If Hide when there are no results is enabled, this tab is disabled.
- Header tab – Messaged displayed above the query results.
- Footer tab – Messaged displayed below the query results.
- Click OK, then Save & Publish the content record.
Note: Results are limited to a maximum of 120. If the column-by-row calculation is greater than 120, the Rows per page value is automatically modified to a value that returns 120 or less.
Examples
Review the examples to better understand how to utilize query templates.
This example details how to display commerce product images in the query Template:
- Go to RiSE > Intelligent Query Architect > New > Query.
- Name the query Product Thumbnails.
- (Sources tab) From the Add source area on the right-side, select Products.
- (Display tab) Scroll down to the bottom of the query window:
- Enter the following information in the Custom section:
- SQL Expression: REPLACE(vBoCsProduct.THUMBNAIL_URL,'~','')
- Alias: Image
- Click Add.
- Enter the following information in the Custom section:
- (Display tab) Continue adding the desired display columns.
- Click Save.
- Click the Template tab.
- Insert the Image data source.
- Click the HTML tab.
- Update the data source to the following: <img src= "{#query.Image}">
- Click back to the Design tab. The image property will look like a broken image.
- Continue adding data sources to the Template tab.
- Save the template. Add the query to content using the Query Template Display content item. See Displaying the query template.
To display user profile pictures, you must use the ContactProfileImage business object and one of the properties with “File Path” in the name.
Do the following to display profile pictures using the query Template tab:
- From the query Display tab, make sure you have one of the following ContactProfileImage properties selected:
- Thumbnail File Path
- Thumbnail Large File Path
- Image File Path
- From the Template tab, insert the image data source:
- Click the HTML tab.
- Update the data source so that the syntax reads like the following: <img src=" {#query.ThumbnailLargeFilePath}">
- Click back to the Design tab. The image property will look like a broken image:
- Continue adding data sources to the Template tab.
- Save the template. Add the query to content using the Query Template Display content item. See Displaying the query template.
Example: The staff users need a quick view of the members’ information, such as ID, name, company, email, phone numbers, and the last-updated date. In this view, staff users also need an indicator for those who have not had any data updated on their profiles in the last year.
Do the following:
- Create a query using the NetContactData and ContactProfileImage business objects.
- Add the following properties to the Display tab:
- Image File Path
- Full Name
- ID
- Title
- Home Phone
- Mobile Phone
- Work Phone
- Company
- Last Updated
- Is Company
- From the Template tab, add the following conditional statement:
- Save the query.
- Add the Query Template Display content item to a content record. See Displaying the query template.
<div class="container-fluid">
<h2 class="display-5 fw-bold">{#query.ID} - {#query.FullName}</h2>
<div class="mb-3" style="max-width: 540px;">
<div class="row g-0">
<div class="col-md-4">
<img src="{#query.ImageFilePath}" alt="" class="img-fluid rounded-start">
</div>
<div class="col-md-8">
<div class="card-body">
{if ISFALSE(#query.IsCompany)}<h5 class="card-title">{#query.Company}</h5>{/endif}
{if ISNOTNULLOREMPTY(#query.Title)}<h6 class="card-subtitle mb-2 text-muted">{#query.Title}</h6>
{/endif}
<p class="card-text">
{if #query.Email NEQ ''}{#query.Email}</br>{/endif}
{if LENGTH(#query.HomePhone) GT 0}Home: {#query.HomePhone}</br>{/endif}
{if LENGTH(#query.WorkPhone) GT 0}Work: {#query.WorkPhone}</br>{/endif}
{if LENGTH(#query.MobilePhone) GT 0}Mobile: {#query.MobilePhone}</br>{/endif}
</p>
<p class="card-text">
<small class="text-muted">Last updated {#query.LastUpdated}</small>
{if (DAYSBETWEEN(#query.LastUpdated, Now) GT 365)} {/endif}
</p>
</div>
</div>
</div>
</div>
<a href="Party.aspx?ID={#query.ID}" class="btn btn-primary btn-lg" role="button" aria-disabled="true">Full Profile</a>
</div>
</div>
In some cases, you may wish to restrict access to content for certain member types. For example, you may only want Chapter members to access the chapter directory on your website. In this scenario, you can create a custom query and use the Query menu content item to create a button that only qualified users have access to.
Creating the custom query
Do the following to create a query that identifies qualified members:
- Go to RiSE > Intelligent Query Architect > New > Query.
- Name the query.
- (Sources tab) Add the following sources:
- NetContactData
- Chapter
- (Sources tab) Creating a custom join where NetContactData.Chapter = Chapter.Chapter Code.
- (Filters tab) Create the following filters:
Table 1: Filter configurations Property Function Comparison Multiple Value In Search? [NetContactData] Chapter None Equal Enabled Constant East Chapter, West Chapter, North Chapter, South Chapter No [NetContactData] Is Member None Equal Constant Yes [NetContactData] Status None Equal Constant Active [NetContactData] Id None Equal Dynamic Selected ID No - (Display tab) Add the desired display columns.
- Save the query to a non-system folder.
- (Template tab) Do the following:
- From the HTML tab, enter
<p><a href="link" target="_blank" class="TextButton">Button Text Here</a></p>
. - Replace "link" with the URL of the page to redirect to. For example, https://<yourwesbite>.com/ContactManagement/Directory.aspx.
- Replace “Button Text Here” with the text to display.
- From the HTML tab, enter
- (Security tab) Set the Access mode to Authenticated Users Full Control.
- Save the query.
Adding the button to content record
After creating the query, add the query to a content record using the Query Template Display content item, which exposes the button.
Do the following to add the button to the content record:
- Go to RiSE >Page Builder > Manage content.
- From a shared content folder, click New > Website Content.
- Add a Title.
- Select Add content.
- Open the Utility folder.
- Select the Query Template Display content item and click OK.
- From the Source query field, add the query you just created.
- Enable the Hide when there are no results checkbox.
- Click OK.
- Click Save & Publish.
Now, only chapter members have access to the directory. When a non-chapter member navigates to the content record, they do not see the button.