{"id":24084,"date":"2024-02-15T14:53:34","date_gmt":"2024-02-15T22:53:34","guid":{"rendered":"https:\/\/docs.extraview.com\/v25\/book\/rules-multi-valued-list-fields-1\/"},"modified":"2025-02-13T13:17:27","modified_gmt":"2025-02-13T21:17:27","slug":"rules-multi-valued-list-fields-1","status":"publish","type":"page","link":"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/","title":{"rendered":"Rules &#038; Multi-Valued List Fields"},"content":{"rendered":"<p>Rule that access multi-valued list fields have a number of specific points that you should understand. The examples in this section all assume you have a multi-valued list field with a name of <code>FRUITS<\/code>, and that valid values within the list are <em>apple, pear, orange, banana<\/em> and <em>raspberry<\/em>.<\/p>\n<h3>Setting Values in a Multi-Valued List Field<\/h3>\n<p>For each assignment you make of a value within a multi-valued field, you are selecting that value. For example, if you want to set both\u00a0<em>apple<\/em> and <em>orange<\/em> you would use:<\/p>\n<div><code>FRUITS = ['apple','orange'];<\/code><\/div>\n<p>The quotes around the values are optional, unless you have a space character within the value.\u00a0 For example, this is a valid statement:<\/p>\n<p><code>FRUITS = [apple, 'orange', 'honeydew melon'];<\/code><\/p>\n<p>If you want to set a single value of <em>pear <\/em>within the list you use a simple assignment statement.<\/p>\n<div><code>FRUITS = 'pear';<\/code><\/div>\n<div><\/div>\n<div>Note that when you assign one or more values to a multi-valued field with an assignment, you are <strong>adding<\/strong> to the existing list values.\u00a0 For example, if the list contains both <em>apple<\/em> and <em>orange<\/em> and you execute this:<\/div>\n<div><\/div>\n<div><code>FRUITS += ['orange', 'raspberry'];<\/code><\/div>\n<div><\/div>\n<div>the list will then contain <em>apple,<\/em> <em>orange<\/em> and<em> raspberry.<\/em><\/div>\n<h3>Adding a Value to an Existing Multi-Valued List Field<\/h3>\n<p><code>FRUITS += 'strawberry';<\/code><\/p>\n<h3>Clearing All Values from a Multi-Valued List Field<\/h3>\n<div>Simply set the the list as follows:<\/div>\n<div><\/div>\n<div><code>FRUITS = '';<\/code><\/div>\n<p>or<\/p>\n<p><code>FRUITS.{clear};<\/code><\/p>\n<h3>Checking Values Exist within a List<\/h3>\n<p>This syntax will find whether the single value of <em>orange <\/em>is currently set within the multi-valued list:<\/p>\n<div><code>if (FRUITS.{contains 'orange'}) { ... };<\/code><\/div>\n<p>This syntax will find whether the values of <em>pear<\/em>, <em>orange <\/em>and <em>banana <\/em>are currently set within the multi-valued list:<\/p>\n<div><code>if (FRUITS.{contains 'pear', 'orange', 'banana'}) { ... };<\/code><\/div>\n<p>This syntax will find whether the values of <em>pear<\/em>, and <em>orange <\/em>are currently set within the multi-valued list, but the value of <em>banana <\/em>is not within the multi-valued list:<\/p>\n<div><code>if (FRUITS.{contains 'pear', 'orange'} &amp;&amp; FRUITS.{excludes 'banana'}) { ... };<\/code><\/div>\n<h3>Check Values in a Multi-Valued List Field are Contained Within a Different Multi-Valued List Field<\/h3>\n<p>The following syntax allows you to check whether all the selected values in one multi-value list field are selected and contained within a different multi-value list field.\u00a0 Say you have two multi-valued list fields, named LIST_FIELD_1 and LIST_FIELD_2.\u00a0 When a user selects various fields in both these lists in an\u00a0<em>add<\/em> or\u00a0<em>edit\u00a0<\/em>screen and then updates the issue, you might want to have a rule that checks whether all the selected values in LIST_FIELD_2 are selected in LIST_FIELD_1.\u00a0 The rule may look like this:<\/p>\n<p><span style=\"color: #aa0000; font-family: courier, monospace;\">&lt;== preupdate ==&gt;<\/span><br \/>\n<span style=\"color: #aa0000; font-family: courier, monospace;\">if (LIST_FIELD_2.{changed} &amp;&amp; LIST_FIELD_1.{contains LIST_FIELD_2}) {<br \/>\nMY_TEXT_FIELD = &#8216;LIST_FIELD_1 contains all the values in LIST_FIELD_2&#8217;;<\/span><br \/>\n<span style=\"color: #aa0000; font-family: courier, monospace;\">}<\/span><\/p>\n<h3>Assignments with Multi-Valued Fields<\/h3>\n<p>You can assign the selected values in a multi-valued list field to a text, text area, print text, or an HTML Area field.\u00a0 When you make the assignment, the \u00a0text, text area, print text, or HTML Area field will contain the entire list of selected values, delimited with semi-colons.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Rule that access multi-valued list fields have a number of specific points that you should understand. The examples in this section all assume you have a multi-valued list field with a name of FRUITS, and that valid values within the list are apple, pear, orange, banana and raspberry. Setting Values in a Multi-Valued List Field&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":24074,"menu_order":13,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_lmt_disableupdate":"no","_lmt_disable":"","_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"class_list":["post-24084","page","type-page","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Rules &amp; Multi-Valued List Fields - Product Documentation<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Rules &amp; Multi-Valued List Fields - Product Documentation\" \/>\n<meta property=\"og:description\" content=\"Rule that access multi-valued list fields have a number of specific points that you should understand. The examples in this section all assume you have a multi-valued list field with a name of FRUITS, and that valid values within the list are apple, pear, orange, banana and raspberry. Setting Values in a Multi-Valued List Field...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/\" \/>\n<meta property=\"og:site_name\" content=\"Product Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-13T21:17:27+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/\",\"url\":\"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/\",\"name\":\"Rules & Multi-Valued List Fields - Product Documentation\",\"isPartOf\":{\"@id\":\"https:\/\/docs.extraview.com\/v25\/#website\"},\"datePublished\":\"2024-02-15T22:53:34+00:00\",\"dateModified\":\"2025-02-13T21:17:27+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/docs.extraview.com\/v25\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ExtraView 25\",\"item\":\"https:\/\/docs.extraview.com\/v25\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Administration Guide\",\"item\":\"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Site Configuration Menu\",\"item\":\"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Business Rules\",\"item\":\"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"Writing Rules\",\"item\":\"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/\"},{\"@type\":\"ListItem\",\"position\":7,\"name\":\"Rules &#038; Multi-Valued List Fields\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/docs.extraview.com\/v25\/#website\",\"url\":\"https:\/\/docs.extraview.com\/v25\/\",\"name\":\"ExtraView Product Documentation\",\"description\":\"ExtraView Documentation\",\"publisher\":{\"@id\":\"https:\/\/docs.extraview.com\/v25\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/docs.extraview.com\/v25\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/docs.extraview.com\/v25\/#organization\",\"name\":\"ExtraView Corporation\",\"url\":\"https:\/\/docs.extraview.com\/v25\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/docs.extraview.com\/v25\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/docs-stg.extraview.com\/wp-content\/uploads\/2024\/03\/favicon.png\",\"contentUrl\":\"https:\/\/docs-stg.extraview.com\/wp-content\/uploads\/2024\/03\/favicon.png\",\"width\":512,\"height\":512,\"caption\":\"ExtraView Corporation\"},\"image\":{\"@id\":\"https:\/\/docs.extraview.com\/v25\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Rules & Multi-Valued List Fields - Product Documentation","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/","og_locale":"en_US","og_type":"article","og_title":"Rules & Multi-Valued List Fields - Product Documentation","og_description":"Rule that access multi-valued list fields have a number of specific points that you should understand. The examples in this section all assume you have a multi-valued list field with a name of FRUITS, and that valid values within the list are apple, pear, orange, banana and raspberry. Setting Values in a Multi-Valued List Field...","og_url":"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/","og_site_name":"Product Documentation","article_modified_time":"2025-02-13T21:17:27+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/","url":"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/","name":"Rules & Multi-Valued List Fields - Product Documentation","isPartOf":{"@id":"https:\/\/docs.extraview.com\/v25\/#website"},"datePublished":"2024-02-15T22:53:34+00:00","dateModified":"2025-02-13T21:17:27+00:00","breadcrumb":{"@id":"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-multi-valued-list-fields-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/docs.extraview.com\/v25\/"},{"@type":"ListItem","position":2,"name":"ExtraView 25","item":"https:\/\/docs.extraview.com\/v25\/"},{"@type":"ListItem","position":3,"name":"Administration Guide","item":"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/"},{"@type":"ListItem","position":4,"name":"Site Configuration Menu","item":"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/"},{"@type":"ListItem","position":5,"name":"Business Rules","item":"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/"},{"@type":"ListItem","position":6,"name":"Writing Rules","item":"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/"},{"@type":"ListItem","position":7,"name":"Rules &#038; Multi-Valued List Fields"}]},{"@type":"WebSite","@id":"https:\/\/docs.extraview.com\/v25\/#website","url":"https:\/\/docs.extraview.com\/v25\/","name":"ExtraView Product Documentation","description":"ExtraView Documentation","publisher":{"@id":"https:\/\/docs.extraview.com\/v25\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/docs.extraview.com\/v25\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/docs.extraview.com\/v25\/#organization","name":"ExtraView Corporation","url":"https:\/\/docs.extraview.com\/v25\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/docs.extraview.com\/v25\/#\/schema\/logo\/image\/","url":"https:\/\/docs-stg.extraview.com\/wp-content\/uploads\/2024\/03\/favicon.png","contentUrl":"https:\/\/docs-stg.extraview.com\/wp-content\/uploads\/2024\/03\/favicon.png","width":512,"height":512,"caption":"ExtraView Corporation"},"image":{"@id":"https:\/\/docs.extraview.com\/v25\/#\/schema\/logo\/image\/"}}]}},"taxonomy_info":[],"featured_image_src_large":false,"author_info":{"display_name":"carl.koppel","author_link":"https:\/\/docs.extraview.com\/v25\/author\/carl-koppel\/"},"comment_info":0,"_links":{"self":[{"href":"https:\/\/docs.extraview.com\/v25\/wp-json\/wp\/v2\/pages\/24084","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.extraview.com\/v25\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/docs.extraview.com\/v25\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/docs.extraview.com\/v25\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.extraview.com\/v25\/wp-json\/wp\/v2\/comments?post=24084"}],"version-history":[{"count":0,"href":"https:\/\/docs.extraview.com\/v25\/wp-json\/wp\/v2\/pages\/24084\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/docs.extraview.com\/v25\/wp-json\/wp\/v2\/pages\/24074"}],"wp:attachment":[{"href":"https:\/\/docs.extraview.com\/v25\/wp-json\/wp\/v2\/media?parent=24084"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}