After you have requested data by means of dataname notation, you have plenty of options to format the data.
You can apply a format to your data by using the following format:
title@content|format:urlvar
After the dataname notation follows a vertical line: |. Then add the format that you want to apply to the data. Below an overview of the different formatting options:
Can only be applied to text.
This option removes all spaces from the text value. So "this is a sentence" becomes "thisisasentence"
Can only be applied to text.
This option converts the text to a text that can be used in a url. In the conversion:
That means that "This can (not) be in a URL" "this-can--not--be-in-a-url". This formatting options is mostly relevant if you want to automate your SEO.
Can be applied to text, numbers and elements.
This option converts the specified data into readable text. So:
Can be applied to text
This formatting option returns the first two sentences of the given text.
Can be applied to text, booleans and numbers
This option makes true or false of the specified value. The following data is converted to false:
The following options are converted to true:
All other values are converted to NULL.
Can be applied to elements
Returns the ID of the element.
Can be applied to numbers and textsFormatting options about elements
If the value is a valid ID of an element, the value is converted to the element itself.
Can be applied to numbers
The input is seen as a timestamp. A readable date display is made of this, for example "Sunday, February 4 2018".
Can be applied to numbers
The input is seen as an amount in cents. The values are converted to a readable view of this amount. The currency that is used the is currency of the website or the system within the dataname is applied. An example is this formatting option: 7689 is converted to "$ 76.89".
This option is mostly relevant when designing product pages for a webshop.
See the page about formatting options for images.
Can be applied to numbers
With the math option you can perform calculations on the current value. Options are:
Can be applied to lists
With the filter option you can filter lists. The syntax is:
filter:dataname:operator:value
For example, when you want to filter a list of subscriptions finding anyone with the first name "John":
filter:firstname@person:=:"John"
Can be applied to lists
The count option gives you the number of elements in a list
Can be applied to lists
Returns the first element from the list
Can be applied to lists
Returns the list as text. With the second parameter you can specify which character or text should be used when merging the list. Some examples:
list_to_string:, gives "one,two,three"
list_to_string:" and " gives "one and two and three"
Within datanames you can also return a specific value under certain conditions. More about this on the page about conditions in datanames.
Not type specific
Somewhere allong formatting a dataname you suddenly need the value from another field. For example, you have had a form where you have asked for a person's name for a very long time. Later on you switched to two separate fields: first name and last name. The original full name field still exists. With the following dataname you can show the value from the original name field, but if it is empty you show the value from the surname field:
name@person|if_break:tekst_is_not:""|dataname:lastname@person
You can find more about the aborting formatting options under a certain condition on the page about conditions in datanames.
Do you want to participate in the dataname project? Or do you want to implement datanames and looking for some help? Send us a message and we'll be teaming up!
Datanames are an essential part of the Webanizr project