{"id":2895,"date":"2024-10-11T12:00:47","date_gmt":"2024-10-11T09:00:47","guid":{"rendered":"https:\/\/www.collectionpro.fi\/ohjeet\/user-data-types\/"},"modified":"2025-06-12T16:16:17","modified_gmt":"2025-06-12T13:16:17","slug":"user-data-types","status":"publish","type":"ht_kb","link":"https:\/\/www.collectionpro.fi\/en\/help\/user-data-types\/","title":{"rendered":"User data types"},"content":{"rendered":"\n<p>This article describes the various user data types in Collection Pro and their behavior during import and export situations.<\/p>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Text types<\/h2>\n\n\n\n<p>Text types are used to store text. Collection Pro supports <code>text<\/code>, <code>text_oneline<\/code>, , <code>string<\/code><code>text_l10n <\/code>and <code>text_l10n_oneline<\/code>. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">text, text_oneline<\/h3>\n\n\n\n<p><code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">text<\/mark><\/code>  and <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">text_oneline<\/mark><\/code> store characters in one language. In the server, these types are treated the same, text_oneline is only a hint for frontends on how to display the data. So it is possible (over the API) to use newlines in a text_online column.  <\/p>\n\n\n\n<p>Text is stored as received, so a leading or trailing space is preserved. Frontends are requested to trim texts before sending them to the API. <\/p>\n\n\n\n<p>Text must be encoded in <a href=\"https:\/\/en.wikipedia.org\/wiki\/UTF-8\">UTF-8<\/a> and stores in all <a href=\"https:\/\/unicode.org\/reports\/tr15\/#Norm_Forms\">normalization forms<\/a>. There is no limit to the length of the text that can be stored. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">API<\/h4>\n\n\n\n<p>Text looks like this when send and received over the API:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n    \"text\": \"this is the text\"\n}<\/code><\/pre>\n\n\n\n<p>The above example has the value <em>this is the text<\/em> for column text.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Index<\/h4>\n\n\n\n<p>Normalization is performed as part of the indexer documentation creation, where all text is run through a <code>icu_normalizer<\/code>.<\/p>\n\n\n\n<p>In the indexer, text is stored using a custom analyzer <code>icu_text<\/code> which works as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"analysis\": {\n   \"icu_text\": {\n     \"type\": \"custom\",\n     \"tokenizer\": \"custom_icu_tokenizer\",\n     \"filter\": &#91;\n       \"icu_folding\"\n     ],\n     \"char_filter\": &#91;\n       \"icu_normalizer\"\n     ]\n  },\n  \"tokenizer\": {\n    \"custom_icu_tokenizer\": {\n      \"type\": \"pattern\",\n      \"pattern\": \"(&#91;&#91;^\\\\p{L}\\\\p{Digit}\\\\uD800-\\\\uDFFF\\\\u2F00-\\\\u2FDF]&amp;&amp;&#91;^&amp;%\u00a7\\\\$\u20ac]])\"\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p><br\/>Text is normalized using the <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/plugins\/current\/analysis-icu-normalization-charfilter.html\"><code>icu_normalizer<\/code><\/a> and tokenized into tokens using the above pattern.<\/p>\n\n\n\n<p>What gets included in tokens:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>All alphabetic letters from any language.<\/li>\n\n\n\n<li>All numeric digits.<\/li>\n\n\n\n<li>Characters in the Unicode surrogate pair range and Kangxi Radicals.<\/li>\n\n\n\n<li>Symbols: <code>&amp;<\/code>, <code>%<\/code>, <code>\u00a7<\/code>, <code>$<\/code>, and <code>\u20ac<\/code>.<\/li>\n<\/ul>\n\n\n\n<p>What causes token separation:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Punctuation marks (except the specified symbols).<\/li>\n\n\n\n<li>Whitespace characters.<\/li>\n\n\n\n<li>Other symbols and control characters not specified.<\/li>\n<\/ul>\n\n\n\n<p>Tokens are then turned into terms using the  <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/plugins\/current\/analysis-icu-folding.html\"><code>icu_folding<\/code><\/a>  token filter. The filter removes all punctuation and turns all characters into lower case. So the token <em>B\u00e4r<\/em> is stored as <em>bar<\/em>.  <\/p>\n\n\n\n<p>Using the API, searches for text can be performed either on the analyzed value (matching the terms), or on the unanalyzed value, which is stored alongside with all terms. The unanalyzed value stores the data <em>as is.<\/em> There is no normalization taking place. <\/p>\n\n\n\n<p>All text for indexed documents is split into chunks of, 8000 UTF-8 characters. When matching full texts in analyzed form, text cannot easily be matched if they exceed 8000 characters. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Sorting<\/h4>\n\n\n\n<p>Sort strings are compiled using the Go library <a href=\"https:\/\/pkg.go.dev\/golang.org\/x\/text\/collate\">collate<\/a>. It uses the first configured database language as assumption in what language the text is in. Numbers are recognized so that <em>Car 100<\/em> sorts after <em>Car 11<\/em>. Text is normalized by the collate library. Internally, we use the hex representation of that string to work around anomalies in Elasticsearch. Some special replacement is always done [TODO LINK].     <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Export<\/h4>\n\n\n\n<p>Text is exported as is, keeping spaces &amp; normalization.<\/p>\n\n\n\n<p>The <strong>XML export<\/strong> looks like this for a column names <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">title<\/mark><\/code> and a value <em>Title<\/em> for the type <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">text_oneline<\/mark><\/code>. The <code>column-api-id<\/code> in this example <em>29<\/em>. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;title type=\"text_oneline\" column-api-id=\"29\"&gt;Title&lt;\/title&gt;<\/code><\/pre>\n\n\n\n<p>For type, text type is <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">text<\/mark><\/code>.<\/p>\n\n\n\n<p>Output in <strong>CSV<\/strong> is as is, same for <strong>JSON<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>String<\/p>\n\n\n\n<p>The <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">string<\/mark><\/code> type&#8217;s main difference to the text type is how it&#8217;s indexed. It is recommended to use string types for identification strings which may contain special characters which would be dropped by the analyzer. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">API<\/h4>\n\n\n\n<p>String looks like this when send and received over the API:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n    \"ref\": \"A$5667\"\n}<\/code><\/pre>\n\n\n\n<p>The above example has the value <em>$5667<\/em> for column <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">ref<\/mark><\/code>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Index<\/h4>\n\n\n\n<p>String values are normalized and lowercased for the index document.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"analyzer\": {\n    \"keyword_lowercase\": {\n      \"tokenizer\": \"keyword\",\n      \"filter\": &#91;\n        \"icu_folding\"\n      ],\n      \"char_filter\": &#91;\n         \"icu_normalizer\"\n      ]\n   }\n}<\/code><\/pre>\n\n\n\n<p><br\/>Strings are normalized using the <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/plugins\/current\/analysis-icu-normalization-charfilter.html\"><code>icu_normalizer<\/code><\/a> and converted to lower case using the <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/plugins\/current\/analysis-icu-folding.html\"><code>icu_folding<\/code><\/a> token filter.<\/p>\n\n\n\n<p>All strings for indexed documents are split into chunks of, 8000 UTF-8 characters. When matching full texts in analyzed form, text cannot easily be matched if they exceed 8000 characters. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Sorting<\/h4>\n\n\n\n<p>The sorting of string values works like for <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">text<\/mark><\/code>. In addition to the text sorting, a pure alphanumerical version is stored in the index alongside with the numerically sortable variant. With that, sorting can sort <em>Car 10<\/em>, <em>Car 11<\/em>, <em>Car 12<\/em>, <em>Car 100<\/em>. Some special replacement is always done.   <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Export<\/h4>\n\n\n\n<p>The <strong>XML<\/strong> looks like for <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">text<\/mark><\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;ref type=\"string\" column-api-id=\"346\"&gt;hall\/7$&lt;\/ref&gt;<\/code><\/pre>\n\n\n\n<p><br\/>In this example, the column <code>ref<\/code> is exported using value <em>hall\/7$<\/em>.<\/p>\n\n\n\n<p>The <strong>CSV<\/strong> and <strong>JSON<\/strong> export the string <em>as is<\/em>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">text_l10n, text_l10n_oneline<\/h3>\n\n\n\n<p>The types <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">text_l10n<\/mark><\/code> and <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">text_l10n_oneline<\/mark><\/code> are designed to store localized values. The format is a JSON object consisting of the language as key and the text as value. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">API<\/h4>\n\n\n\n<p>Localized text looks like this send and received over the API.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"title_loca\": {\n    \"fi-FI\": \"Finnish\",\n    \"en-US\": \"English\"\n  }\n}<\/code><\/pre>\n\n\n\n<p>The above example set the Finnish value <em>Finnish <\/em>and English value <em>English <\/em>for column <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">title_loca<\/mark><\/code>.<br\/>The API does not check the language entered. So loading and saving an unspecified database language is supported. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Index<\/h4>\n\n\n\n<p>Indexing is done the same way <code>text<\/code> format is indexed. Only enabled database languages are mapped into the index, other languages are ignored. After changing the settings for the database languages, a reindex is required.  <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Sorting<\/h4>\n\n\n\n<p>Sorting is performed using a collate string produced by the Go library <a href=\"https:\/\/pkg.go.dev\/golang.org\/x\/text\/collate\">collate<\/a>. The language is parsed as <a href=\"https:\/\/www.rfc-editor.org\/info\/bcp47\">BCP 47<\/a> string and passed to the library. Some special replacement is done:  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>'\u02be': '@', \/\/     02BE    Hamza (vorne offen) @ sorts this before A\n'\u02bf': '@', \/\/     02BF    Ayn (hinten offen) @ sorts this before A<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Export<\/h4>\n\n\n\n<p><strong>XML exported data<\/strong> looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;title_loca type=\"text_l10n\" column-api-id=\"81\"&gt;\n  &lt;fi-Fi&gt;Finnish&lt;\/fi-FI&gt;\n  &lt;en-US&gt;English&lt;\/en-US&gt;\n&lt;\/title_loca&gt;<\/code><\/pre>\n\n\n\n<p><br\/>The example shows the XML snippet for a column <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">title_loca<\/mark><\/code> with the <mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">type <code>text_l10n<\/code><\/mark>.<\/p>\n\n\n\n<p>In <strong>CSV, the values<\/strong> are exported like this:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><thead><tr><th>title_loca.fi-FI<\/th><th>title_loca.en-US<\/th><\/tr><\/thead><tbody><tr><td>Finnish<\/td><td>English<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><br\/>For each language exported, a suffix <code>.&lt;code&gt;<\/code> is added to the column name.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n<\/div><\/div>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Number types<\/h2>\n\n\n\n<p>Number types are used to store numbers. CollectionPro supports <code>number<\/code>, <code>double <\/code>and <code>integer.2<\/code>. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Number<\/h3>\n\n\n\n<p>The type <code>number<\/code> stores integers between <code>-(2**53)+1<\/code> and (<code>2**53)-1<\/code>. This follows the recommendation in <a href=\"https:\/\/datatracker.ietf.org\/doc\/html\/rfc8259\">RFC 8259<\/a>. The range is between &#8211;<code>9,007,199,254,740,991<\/code> and <code>9,007,199,254,740,991<\/code> (incl.).  <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">API<\/h4>\n\n\n\n<p>Number looks like this when send and received over the API:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n    \"number\": 1234\n}<\/code><\/pre>\n\n\n\n<p>The above example has the value <em>1234<\/em> for column <code>number<\/code>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Index<\/h4>\n\n\n\n<p>The index stores the <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">number<\/mark><\/code> as <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/number.html\"><code>long<\/code><\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Sorting<\/h4>\n\n\n\n<p>The sorting is independent of the requested search language.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"export\">Export<\/h4>\n\n\n\n<p>The XML Export looks like this:<a href=\"https:\/\/docs.fylr.io\/for-developers\/types\/number#index\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;number type=\"number\" column-api-id=\"10\"&gt;1234&lt;\/number&gt;<\/code><\/pre>\n\n\n\n<p><br\/>This shows the example export for column <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">number<\/mark><\/code> and a value of <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">1234<\/mark><\/code>.<\/p>\n\n\n\n<p><strong>CSV<\/strong> and <strong>JSON <\/strong>export the number as is.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">integer.2<\/h3>\n\n\n\n<p>The <code>integer.2<\/code> type is like a currency type. The value is stored with a 2-digit fraction without loss. Internally server stored this as integer. Representations of the value in export and standard info display the fractions. For example, the value <code>1234<\/code> will display and be rendered as <code>12.34<\/code>. The limits for this type are the same as for number.     <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">API<\/h4>\n\n\n\n<p>Number looks like this when send and received over the API:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n    \"integer_2\": 567\n}<\/code><\/pre>\n\n\n\n<p>The above example has the value <em>5.67<\/em> for column <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">integer.2<\/mark><\/code>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Index<\/h4>\n\n\n\n<p>The index stores the <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">integer.2<\/mark><\/code> as <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/number.html\"><code>long<\/code><\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Sorting<\/h4>\n\n\n\n<p>The sorting is independent of the requested search language.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"export\">Export<\/h4>\n\n\n\n<p>The XML Export looks like this:<a href=\"https:\/\/docs.fylr.io\/for-developers\/types\/number#index\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;integer_2 type=\"integer.2\" column-api-id=\"4\"&gt;5.67&lt;\/number&gt;<\/code><\/pre>\n\n\n\n<p><br\/>This shows the example export for column <mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">integer_2 <\/mark>and a value of in <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">5.67<\/mark><\/code>.<\/p>\n\n\n\n<p><strong>CSV<\/strong> export uses <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">5.67<\/mark><\/code> whereas the <strong>JSON <\/strong>exports the value as <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">567<\/mark><\/code>.<a href=\"https:\/\/docs.fylr.io\/for-developers\/user-data-types\/number\"><\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">double<\/h3>\n\n\n\n<p>The type <code>double<\/code> supports store and load for a floating point number with 64 bits (Go type <code>float64<\/code>). The range for that number is approximately <code>-1.7976931348623157e+308<\/code> to <code>1.7976931348623157e+308<\/code>. Go adheres to <a href=\"https:\/\/en.wikipedia.org\/wiki\/IEEE_754\">IEEE 754<\/a> for storing the values.  <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">API<\/h4>\n\n\n\n<p>Number looks like this when send and received over the API:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n    \"double\": 1234.5678\n}<\/code><\/pre>\n\n\n\n<p>Numbers are guaranteed to keep their value, but the JSON parser may change <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">1e4 <\/mark><\/code>into <mark style=\"background-color:#eeeeee\" class=\"has-inline-color\"><code>10000<\/code> <\/mark>upon load.<a href=\"https:\/\/docs.fylr.io\/for-developers\/user-data-types\/double#index\"><\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Index<\/h4>\n\n\n\n<p>The type <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">double<\/mark><\/code> is stored as type <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/number.html\">double<\/a> in the indexer.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Sorting<\/h4>\n\n\n\n<p>The sorting is independent of the requested search language.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"export\">Export<\/h4>\n\n\n\n<p>The XML Export looks like this:<a href=\"https:\/\/docs.fylr.io\/for-developers\/types\/number#index\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;double type=\"double\" column-api-id=\"2\"&gt;1234.5678&lt;\/number&gt;<\/code><\/pre>\n\n\n\n<p><br\/>This shows the example export for column <mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">double <\/mark>and a value of in <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">1234.5678<\/mark><\/code>.<\/p>\n\n\n\n<p><strong>CSV<\/strong> and <strong>JSON<\/strong> export the number as is.<a href=\"https:\/\/docs.fylr.io\/for-developers\/user-data-types\/integer.2\"><\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Date types<\/h2>\n\n\n\n<p>The date types store dates with or without time and also date range. The server supports dates where only the year is given or only the year and month. The types are <code>date, date+time<\/code> and <code>daterange<\/code>.  <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">date, date+time<\/h3>\n\n\n\n<p>The types <code>date<\/code> and <code>date+time<\/code> are used to load and store dates and date+times defined in <a href=\"https:\/\/en.wikipedia.org\/wiki\/ISO_8601\">ISO8601<\/a>. Note that server doesn&#8217;t support a type to store a duration or just a time or date without year. <\/p>\n\n\n\n<p>The server does support storing just the calendar year or year and month. These dates are stored as date range internally, so e.g. <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">2000<\/mark><\/code> would be stored as range from <mark style=\"background-color:#eeeeee\" class=\"has-inline-color\"><code>2000-01-01 00:00:00<\/code> to <code>2000-31-12 25:59:59<\/code><\/mark>. <\/p>\n\n\n\n<p>The supported range for dates is between years <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">-292,277,022,399<\/mark><\/code> and <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">292,277,022,399<\/mark><\/code>. This is roughly UNIX seconds stored in a 64-bit integer. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">API<\/h4>\n\n\n\n<p>The API treats the types date and date+time the same. So it is possible to store a date+time in a date value. The type is merely a hint for frontends to render the value accordingly.  <\/p>\n\n\n\n<p>The longest possible form of the value contains the timezone as shown in this example:Copy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"date\": {\n    \"value\": \"2010-12-10T12:45:00+01:00:00\"\n  }\n}<\/code><\/pre>\n\n\n\n<p>This stores the date <code>2010-12-20<\/code> with time <code>12:45:00<\/code> in time zone <code>+01:00:00<\/code>. Time zones must be given using the offset. The server keeps the time zone. If a value without a time zone is given, the server assumes UTC as time zone.   <\/p>\n\n\n\n<p>The shortest possible date value looks like this:Copy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"date\": {\n    \"value\": \"2010\"\n  }\n}<\/code><\/pre>\n\n\n\n<p>This has the date <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">2010<\/mark><\/code> spanning a range from <mark style=\"background-color:#eeeeee\" class=\"has-inline-color\"><code>2010-01-01 00:00:00<\/code> to <code>2010-31-12 25:59:59<\/code><\/mark>.<\/p>\n\n\n\n<p>The API can parse a wide variety of formats. This includes parsing fractional seconds. Fractional seconds are discarded.  <\/p>\n\n\n\n<p>The output are always as follows<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>YEAR              = \"2006\"\nYEAR_MONTH        = \"2006-01\"\nDATE              = \"2006-01-02\"\nDATE_TIME         = \"2006-01-02T15:04\"\nDATE_TIME_SEC     = \"2006-01-02T15:04:05\"\nDATE_TIME_SEC_TZ  = \"2006-01-02T15:04:05Z07:00\"\nDATE_TIME_SEC_TZS = \"2006-01-02T15:04:05Z07:00:00\"<\/code><\/pre>\n\n\n\n<p>The left side reflects the recognized width of the value.<\/p>\n\n\n\n<p class=\"has-background\" style=\"background-color:#eeeeee\">Note: The parser does not support sending a timezone for shortened date strings. For shorter date strings, the stored time zone is always UTC. <a href=\"https:\/\/docs.fylr.io\/for-developers\/user-data-types\/date-datetime#index\"><\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Index<\/h4>\n\n\n\n<p>The server calculates all dates to index based on the UNIX seconds computed for the UTC time zone of the given date. The values are stored as   <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/number.html\"><code>long<\/code><\/a>  in the indexer. Various values are calculated to reflect the range every date creates. Alongside the <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color has-black-color\">from<\/mark><\/code> and <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">to<\/mark><\/code> values, a <mark style=\"background-color:#eeeeee\" class=\"has-inline-color\"><code>from_to<\/code> value<\/mark> is stored which allows for aggregations using the middle value of a date.  <\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"sorting\">Sorting<\/h4>\n\n\n\n<p>Sorting can be done by using the stored subfield <code>from<\/code>, <code>to<\/code> or <code>from_to<\/code> (default). Using the API sort values can be adjusted to match a specific date width (<code>day<\/code>, <code>week<\/code>, <code>month<\/code>, <code>year<\/code>). With that, values spanning two years in UTC (this New Year&#8217;s Eve in Sydney and Los Angeles), can be adjusted to be sorted by the same value using width <code>year<\/code>.  <\/p>\n\n\n\n<p>Sort values can also be adjusted to a specific timezone using the API.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Export<\/h4>\n\n\n\n<p>The XML contains the date rendered according to the stored width of the date.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;date type=\"date\" column-api-id=\"2\"&gt;2010-12-10T12:45:00+01:00:00&lt;\/date&gt;<\/code><\/pre>\n\n\n\n<p>The example shows the output for a column date with date value <code><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">2010-12-10T12:45:00+01:00:00<\/mark><\/code>.<\/p>\n\n\n\n<p>The same value is used to the export in <strong>CSV<\/strong> and <strong>JSON<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">daterange<\/h3>\n\n\n\n<p>The <code><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">daterange<\/mark><\/code> type stores a lower and upper value of a date range. Either one can be omitted to store an open range. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"api\"><a href=\"https:\/\/docs.fylr.io\/for-developers\/user-data-types\/daterange#api\"><\/a>API<\/h4>\n\n\n\n<p>The API uses an object with from and to for the daterange type:Copy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"daterange\": {\n    \"from\": \"2001\",\n    \"to\": \"2010\",\n    \"text\": {\n      \"fi-FI\": \"Uuden vuosituhannen ensimm\u00e4inen vuosikymmen\",\n      \"en-US\": \"The first decade in the new millenium\"\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p>Parsing of the dates works the same as for the <code><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">date<\/mark>, <mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">date+time<\/mark><\/code> type. Thus, a <code><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">daterange<\/mark><\/code> can store the full set of widths available for the dates in fylr. The shortest date is the year and the longest the full time including a timezone with seconds.  <\/p>\n\n\n\n<p>Alongside with the date values, a textual value for the <code><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">daterang<\/mark>e<\/code> can be set. The format of the text property matches the format of the <code>text_l10n<\/code> type. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"index\"><a href=\"https:\/\/docs.fylr.io\/for-developers\/user-data-types\/daterange#index\"><\/a>Index<\/h4>\n\n\n\n<p>The index works the same as for the <code>date, date+time<\/code> type. Internally server always works with date ranges to store values. <\/p>\n\n\n\n<p>Alongside the <code><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">from<\/mark><\/code> and <mark style=\"background-color:#8ed1fc\" class=\"has-inline-color has-black-color\"><code>to<\/code> values<\/mark>, a <code><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">from_to<\/mark><\/code> value is stored which allows for aggregations using the middle value of a date. To aggregate over the range, <strong>server<\/strong> additionally stores a <code><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color has-black-color\">range<\/mark><\/code> value which consists of all values between the lower and upper limit. Server stores all years, months and days found in between the lower and upper value of the range, resp. If the date has the width <code><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">year<\/mark><\/code>, all years in between are stored for aggregations. E.g. for the above example, the dates <code><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">2001-01-01 00:00:00, 2002-01-01 00:00:00, ..., 2010-01-01 00:00:00<\/mark><\/code>.    <\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"sorting\"><a href=\"https:\/\/docs.fylr.io\/for-developers\/user-data-types\/daterange#sorting\"><\/a>Sorting<\/h4>\n\n\n\n<p>Sorting works the same as described in for the <code><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">date<\/mark>, <mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">date+time<\/mark><\/code> type.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"export\"><a href=\"https:\/\/docs.fylr.io\/for-developers\/user-data-types\/daterange#export\"><\/a>Export<\/h4>\n\n\n\n<p>The XML Export for the above example looks like this:Copy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;daterange type=\"daterange\" column-api-id=\"4\"&gt;\n  &lt;from&gt;2001&lt;\/from&gt;\n  &lt;to&gt;2010&lt;\/to&gt;\n  &lt;text&gt;\n    &lt;de-DE&gt;Die erste Dekade im neuen Millennium&lt;\/de-DE&gt;\n    &lt;en-US&gt;The first decade in the new millenium&lt;\/en-US&gt;\n  &lt;\/text&gt;\n&lt;\/daterange&gt;<\/code><\/pre>\n\n\n\n<p>The <strong>JSON<\/strong> exports the data like this:Copy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"daterange\": {\n    \"from\": \"2001\",\n    \"to\": \"2010\",\n    \"text\": {\n      \"de-DE\": \"Die erste Dekade im neuen Millenium\",\n      \"en-US\": \"The first decade in the new millenium\"\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p><strong>CSV<\/strong> exports like this:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><thead><tr><th>daterange.from<\/th><th>daterange.to<\/th><th>daterange.text.fi-EN<\/th><th>daterange.text.en-US<\/th><\/tr><\/thead><tbody><tr><td>2001<\/td><td>2010<\/td><td>The first decade of the new millennium<\/td><td>The first decade in the new millenium<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n<\/div><\/div>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Other types<\/h2>\n\n\n\n<p>Other supported data types like <code>boolean<\/code>, <code>file <\/code>and <code>geojson<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Boolean<\/h3>\n\n\n\n<p>The type <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">boolean<\/mark><\/code> can be used to store two states, <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">false<\/mark><\/code> and <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">true<\/mark><\/code>. The default is <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">false<\/mark><\/code>. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">API<\/h4>\n\n\n\n<p>Boolean looks like this when send and received over the API:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n    \"bool\": true\n}<\/code><\/pre>\n\n\n\n<p>The above example has the value <em>true<\/em> for column <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">bool<\/mark><\/code>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Index<\/h4>\n\n\n\n<p>The indexed document contains an entry with <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">false<\/mark><\/code> or <code><code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">true<\/mark><\/code><\/code>. It is mapped as type   <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/boolean.html\"><code>boolean<\/code><\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Sorting<\/h4>\n\n\n\n<p><a href=\"https:\/\/docs.fylr.io\/for-developers\/types\/boolean#sorting\"><\/a>The ascending order of the sort is <code><code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">false<\/mark><\/code> <\/code>, <code><code><code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">true<\/mark><\/code><\/code><\/code>. The sorting is independent of the requested search language. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Export<\/h4>\n\n\n\n<p>The <strong>XML representation<\/strong> looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>&lt;bool type=\"boolean\" column-api-id=\"2\"&gt;true&lt;\/bool&gt;<\/code><\/code><\/pre>\n\n\n\n<p>This is for a column <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">bool<\/mark><\/code> and the value <code><code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">true<\/mark><\/code><\/code>. <code><code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">false<\/mark><\/code> <\/code>is also always rendered.<\/p>\n\n\n\n<p>The <strong>CSV representation<\/strong> is <code><code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">false<\/mark><\/code> <\/code>or <code><code><code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">true<\/mark><\/code><\/code><\/code>, resp.<\/p>\n\n\n\n<p>The <strong>JSON representation<\/strong> is a JSON boolean.<\/p>\n\n\n\n<p><em>The storage inside the server distinguished between <\/em><code><em>null<\/em><\/code><em> and <\/em><code><em>false<\/em><\/code><em>, but this is not visible over the API.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">geojson<\/h3>\n\n\n\n<p>The <code>geojson<\/code> type stores <a href=\"https:\/\/geojson.org\/\">GeoJSON<\/a> according to <a href=\"https:\/\/datatracker.ietf.org\/doc\/html\/rfc7946\">RFC 7946<\/a>. For full <strong>GeoJSON<\/strong> support, you need to use <a href=\"https:\/\/opensearch.org\/\"><strong>Opensearch<\/strong><\/a> as indexer or a licensed <a href=\"https:\/\/www.elastic.co\/subscriptions\"><strong>Elasticsearch<\/strong><\/a>. <\/p>\n\n\n\n<p>Also, for <strong>server<\/strong> you will need a license with <strong>GeoJSON<\/strong> support. The license is not needed to use <strong>GeoJSON<\/strong> over <strong>\/api\/db<\/strong>, but it is for <strong>\/api\/search<\/strong>. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">API<\/h4>\n\n\n\n<p>GeoJSON can contain multiple types of geo coordinates. The simplest type is Point which references a single point using latitude, longitude and altitude (optional): <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"geo\": {\n    \"type\": \"Point\",\n    \"coordinates\": &#91;6.8652, 45.8326, 10]\n  }\n}<\/code><\/pre>\n\n\n\n<p>In this example sets a <code>Point<\/code> in column <code>geo<\/code>: The longitude is set to <code>6.8652<\/code>, latitude to <code>45.8326<\/code> and altitude to <code>10<\/code>. Other types storable in <strong>GeoJSON<\/strong> are: \u201cPoint\u201d, \u201cMultiPoint\u201d, \u201cLineString\u201d, \u201cMultiLineString\u201d, \u201cPolygon\u201d, \u201cMultiPolygon\u201d, and \u201cGeometryCollection\u201d. fylr also supports \u201cFeature\u201d and \u201cFeatureCollection\u201d.  <\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"index\">Index<\/h4>\n\n\n\n<p>The type <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/geo-shape.html\"><code>geo_shape<\/code><\/a> is used to store the <strong>GeoJSON<\/strong> value in the indexer.<\/p>\n\n\n\n<p>In some rare cases, the API will accept the <strong>GeoJSON<\/strong> but the indexer won&#8217;t. You will find these cases by looking for INDEX_ERROR events in <strong>\/inspect\/events<\/strong> or the Event Manager. If you encounter such a problem, your need to amend your data.  <\/p>\n\n\n\n<p>The values of all <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">properties<\/mark><\/code> of types \u201cFeature\u201d and \u201cFeatureCollection\u201d are collected and indexed as <code>text<\/code>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Sorting<\/h4>\n\n\n\n<p>Sorting is not supported for the <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color\">geojson<\/mark><\/code> type.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Export<\/h4>\n\n\n\n<p>The <strong>XML<\/strong> exports the actual GeoJSON value in JSON format. For the above example: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;geo type=\"geo_json\" column-api-id=\"2\"&gt;\n   {&amp;#34;coordinates&amp;#34;:&#91;6.8652,45.8326,10],&amp;#34;type&amp;#34;:&amp;#34;Point&amp;#34;}\n&lt;\/geo&gt;<\/code><\/pre>\n\n\n\n<p>The <strong>CSV<\/strong> contains the JSON as text:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\"coordinates\":&#91;6.8652,45.8326,10],\"type\":\"Point\"}<\/code><\/pre>\n\n\n\n<p>Same with <strong>JSON,<\/strong> the export looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"geo\": {\n  \"type\": \"Point\",\n  \"coordinates\": &#91;\n    6.8652,\n    45.8326,\n    10\n  ]\n},<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This article describes the various user data types in Collection Pro and their behavior during import and export situations. Text types Text types are used to store text. Collection Pro supports text, text_oneline, , stringtext_l10n and text_l10n_oneline. text, text_oneline text and text_oneline store characters in one language. In the server, these types are treated the&#8230;<\/p>\n","protected":false},"author":2,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[82],"ht-kb-tag":[],"class_list":["post-2895","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-for-developers"],"_links":{"self":[{"href":"https:\/\/www.collectionpro.fi\/en\/wp-json\/wp\/v2\/ht-kb\/2895"}],"collection":[{"href":"https:\/\/www.collectionpro.fi\/en\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.collectionpro.fi\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.collectionpro.fi\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.collectionpro.fi\/en\/wp-json\/wp\/v2\/comments?post=2895"}],"version-history":[{"count":1,"href":"https:\/\/www.collectionpro.fi\/en\/wp-json\/wp\/v2\/ht-kb\/2895\/revisions"}],"predecessor-version":[{"id":2896,"href":"https:\/\/www.collectionpro.fi\/en\/wp-json\/wp\/v2\/ht-kb\/2895\/revisions\/2896"}],"wp:attachment":[{"href":"https:\/\/www.collectionpro.fi\/en\/wp-json\/wp\/v2\/media?parent=2895"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.collectionpro.fi\/en\/wp-json\/wp\/v2\/ht-kb-category?post=2895"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.collectionpro.fi\/en\/wp-json\/wp\/v2\/ht-kb-tag?post=2895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}