Previous page | Data Integration | Next page |
Displaying text if records exist |
Generally when you display records from a query, you display all the records (albeit paged if there are many). However, there are times when you want to display some text if there are some records, and display some different text if there are no records. The 'text' could be anything, including images, links, etc. Example: In this example we provide a link through to a page containing an embedded Query with full details of related information, but, importantly, making it so that the link does not appear if there are no records to show. In the following description we assume that you already have the Query that displays the records (the 'Target query'), and that is embedded on a page (the 'Target page'). We have another page (the 'Source page') that needs to contain a link to the target page, which will contain the link that should only appear if there are some records that would display on the target page. We'll also make the source page display a message that there are no records if that is the case. To do this, we need to create a new Custom View, based on the target query. We will call this the 'Link view', and use it as shown below: If there are records to see, then the visitor will experience the site as shown in the left column of the schematic.
The link view, being a Custom View, allows us to configure the "Custom View" text, and the "Custom View - No Records" text.
Now embed the 'link view' on the source page.
Note: If the source page is not a 'simple' page, but contains embedded queries displaying different content depending on the parameters it is called with, then you may want the 'link view' to include and pass forward some of the paramaters to the target page.
|