In Deployteq contents, you can retrieve data from a standalone datamodel table. The Smarty function "lookup" allows you to fetch all data from a datamodel table, for instance, to retrieve all product information.

Lookup

{{$lookup.<table_name>}}

Examples

Retrieve all product data from the datamodel table

<!--{foreach $lookup.products as $article}-->
  <li>Brand: {{$article.brand}}</li>
  <li>Description: {{$article.description}}</li>
  <li>Condition: {{$article.condition}}</li>
  <li>Material: {{$article.material}}</li>
  <li>Link: {{$article.link}}</li>
  <li>Image: {{$article.image_link}}</li>
<!--{foreachelse}-->
   Default variation when no data is found.
<!--{/foreach}-->



It's also possible to filter the data from a datamodel table to retrieve only relevant information.

$lookup.<table_name>|filter:"<Field_name>":"<Field_value>"

Filter in table 'products' on productid 30

<!--{foreach $lookup.products|filter:"id":"30" as $article}-->
  <li>Brand: {{$article.brand}}</li>
  <li>Description: {{$article.description}}</li>
  <li>Condition: {{$article.condition}}</li>
  <li>Material: {{$article.material}}</li>
  <li>Link: {{$article.link}}</li>
  <li>Image: {{$article.image_link}}</li>
<!--{foreachelse}-->
  Default variation when no data is found.
<!--{/foreach}-->

Filtering in the 'products' table based on a property named 'productid':

<!--{foreach $lookup.products|filter:"id":$property[productid] as $article}-->
  <li>Brand: {{$article.brand}}</li>
  <li>Description: {{$article.description}}</li>
  <li>Condition: {{$article.condition}}</li>
  <li>Material: {{$article.material}}</li>
  <li>Link: {{$article.link}}</li>
  <li>Image: {{$article.image_link}}</li>
<!--{foreachelse}-->
  Default variation when no data is found.
<!--{/foreach}-->

The following example retrieves all products using the creation date with the `date_format` modifier:

Filter the product values based on a date

See our latest products:

<!--{foreach $lookup.products|filter:"createdat":"{{$smarty.now|date_format:'%Y-%m-%d'}}" as $article}-->
  <li>Brand: {{$article.brand}}</li>
  <li>Description: {{$article.description}}</li>
  <li>Condition: {{$article.condition}}</li>
  <li>Material: {{$article.material}}</li>
  <li>Link: {{$article.link}}</li>
  <li>Image: {{$article.image_link}}</li>
<!--{foreachelse}-->
  Default variation when no data is found.
<!--{/foreach}-->