{"id":22269,"date":"2024-02-15T14:48:40","date_gmt":"2024-02-15T22:48:40","guid":{"rendered":"https:\/\/docs.extraview.com\/v22\/book\/rules-multi-valued-list-fields\/"},"modified":"2024-02-15T14:48:40","modified_gmt":"2024-02-15T22:48:40","slug":"rules-multi-valued-list-fields","status":"publish","type":"page","link":"https:\/\/docs.extraview.com\/v22\/rules-multi-valued-list-fields\/","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>\n\tSetting 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&nbsp;<em>apple<\/em> and <em>orange<\/em> you would use:<\/p>\n<div>\n\t<code>FRUITS = ['apple','orange'];<\/code><\/div>\n<p>The quotes around the values are optional, unless you have a space character within the value.&nbsp; 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>\n\t<code>FRUITS = 'pear';<\/code><\/div>\n<div>\n\t&nbsp;<\/div>\n<div>\n\tNote 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.&nbsp; For example, if the list contains both <em>apple<\/em> and <em>orange<\/em> and you execute this:<\/div>\n<div>\n\t&nbsp;<\/div>\n<div>\n\t<code>FRUITS = ['orange', 'raspberry'];<\/code><\/div>\n<div>\n\t&nbsp;<\/div>\n<div>\n\tthe list will then contain <em>apple,<\/em> <em>orange<\/em> and<em> raspberry.<\/em><\/div>\n<h3>\n\tAdding a Value to an Existing Multi-Valued List Field<\/h3>\n<p><code>FRUITS += 'strawberry';<\/code><\/p>\n<h3>\n\tClearing All Values from a Multi-Valued List Field<\/h3>\n<div>\n\tSimply set the the list as follows:<\/div>\n<div>\n\t&nbsp;<\/div>\n<div>\n\t<code>FRUITS = '';<\/code><\/div>\n<p>or<\/p>\n<p><code>FRUITS.{clear};<\/code><\/p>\n<h3>\n\tChecking 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>\n\t<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>\n\t<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>\n\t<code>if (FRUITS.{contains 'pear', 'orange'} &amp;&amp; FRUITS.{excludes 'banana'}) { ... };<\/code><\/div>\n<h3>\n\tCheck 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.&nbsp; Say you have two multi-valued list fields, named LIST_FIELD_1 and LIST_FIELD_2.&nbsp; When a user selects various fields in both these lists in an&nbsp;<em>add<\/em> or&nbsp;<em>edit&nbsp;<\/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.&nbsp; The rule may look like this:<\/p>\n<p><span style=\"color: rgb(170, 0, 0); font-family: courier, monospace;\">&lt;== preupdate ==&gt;<\/span><br \/>\n\t<span style=\"color: rgb(170, 0, 0); font-family: courier, monospace;\">if (LIST_FIELD_2.{changed} &amp;&amp; LIST_FIELD_1.{contains LIST_FIELD_2}) {<br \/>\n\t&nbsp; &nbsp; MY_TEXT_FIELD = &#8216;LIST_FIELD_1 contains all the values in LIST_FIELD_2&#8217;;<\/span><br \/>\n\t<span style=\"color: rgb(170, 0, 0); font-family: courier, monospace;\">}<\/span><\/p>\n<h3>\n\tAssignments 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.&nbsp; When you make the assignment, the &nbsp;text, 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":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_lmt_disableupdate":"","_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-22269","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\/v22\/rules-multi-valued-list-fields\/\" \/>\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\/v22\/rules-multi-valued-list-fields\/\" \/>\n<meta property=\"og:site_name\" content=\"Product Documentation\" \/>\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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/docs.extraview.com\/v22\/rules-multi-valued-list-fields\/\",\"url\":\"https:\/\/docs.extraview.com\/v22\/rules-multi-valued-list-fields\/\",\"name\":\"Rules & Multi-Valued List Fields - Product Documentation\",\"isPartOf\":{\"@id\":\"https:\/\/docs.extraview.com\/v22\/#website\"},\"datePublished\":\"2024-02-15T22:48:40+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/docs.extraview.com\/v22\/rules-multi-valued-list-fields\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/docs.extraview.com\/v22\/rules-multi-valued-list-fields\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/docs.extraview.com\/v22\/rules-multi-valued-list-fields\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/docs.extraview.com\/v22\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Rules &#038; Multi-Valued List Fields\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/docs.extraview.com\/v22\/#website\",\"url\":\"https:\/\/docs.extraview.com\/v22\/\",\"name\":\"ExtraView Product Documentation\",\"description\":\"ExtraView Documentation\",\"publisher\":{\"@id\":\"https:\/\/docs.extraview.com\/v22\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/docs.extraview.com\/v22\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/docs.extraview.com\/v22\/#organization\",\"name\":\"ExtraView Corporation\",\"url\":\"https:\/\/docs.extraview.com\/v22\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/docs.extraview.com\/v22\/#\/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\/v22\/#\/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\/v22\/rules-multi-valued-list-fields\/","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\/v22\/rules-multi-valued-list-fields\/","og_site_name":"Product Documentation","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/docs.extraview.com\/v22\/rules-multi-valued-list-fields\/","url":"https:\/\/docs.extraview.com\/v22\/rules-multi-valued-list-fields\/","name":"Rules & Multi-Valued List Fields - Product Documentation","isPartOf":{"@id":"https:\/\/docs.extraview.com\/v22\/#website"},"datePublished":"2024-02-15T22:48:40+00:00","breadcrumb":{"@id":"https:\/\/docs.extraview.com\/v22\/rules-multi-valued-list-fields\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/docs.extraview.com\/v22\/rules-multi-valued-list-fields\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/docs.extraview.com\/v22\/rules-multi-valued-list-fields\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/docs.extraview.com\/v22\/"},{"@type":"ListItem","position":2,"name":"Rules &#038; Multi-Valued List Fields"}]},{"@type":"WebSite","@id":"https:\/\/docs.extraview.com\/v22\/#website","url":"https:\/\/docs.extraview.com\/v22\/","name":"ExtraView Product Documentation","description":"ExtraView Documentation","publisher":{"@id":"https:\/\/docs.extraview.com\/v22\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/docs.extraview.com\/v22\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/docs.extraview.com\/v22\/#organization","name":"ExtraView Corporation","url":"https:\/\/docs.extraview.com\/v22\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/docs.extraview.com\/v22\/#\/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\/v22\/#\/schema\/logo\/image\/"}}]}},"taxonomy_info":[],"featured_image_src_large":false,"author_info":{"display_name":"carl.koppel","author_link":"https:\/\/docs.extraview.com\/v22\/author\/carl-koppel\/"},"comment_info":0,"_links":{"self":[{"href":"https:\/\/docs.extraview.com\/v22\/wp-json\/wp\/v2\/pages\/22269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.extraview.com\/v22\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/docs.extraview.com\/v22\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/docs.extraview.com\/v22\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.extraview.com\/v22\/wp-json\/wp\/v2\/comments?post=22269"}],"version-history":[{"count":0,"href":"https:\/\/docs.extraview.com\/v22\/wp-json\/wp\/v2\/pages\/22269\/revisions"}],"wp:attachment":[{"href":"https:\/\/docs.extraview.com\/v22\/wp-json\/wp\/v2\/media?parent=22269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}