{"id":24086,"date":"2024-02-15T14:53:34","date_gmt":"2024-02-15T22:53:34","guid":{"rendered":"https:\/\/docs.extraview.com\/v25\/book\/rules-repeating-rows-1\/"},"modified":"2025-02-13T13:18:39","modified_gmt":"2025-02-13T21:18:39","slug":"rules-repeating-rows-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-repeating-rows-1\/","title":{"rendered":"Rules &#038; Repeating Rows"},"content":{"rendered":"<p>In general, rules are executed on repeating rows, just as they are executed on the main <em>Add<\/em> and <em>Edit<\/em> screens. However there are some important differences.<\/p>\n<ul>\n<li>\n\t\tThe first significant difference is that a rule such as:<br \/>\n\t\t&nbsp;<\/p>\n<div class=\"fixedWidthFont\">\n\t\t\t&lt;== onchange ==&gt;<br \/>\n\t\t\tRR_FIELD = &#8216;value&#8217;;<\/div>\n<p>\n\t\tis executed for <u>all<\/u> repeating rows in existence at the time of the <span class=\"fixedWidthFont\">onchange<\/span> event, in the order of the repeating rows. You can take advantage of this to perform an evaluation of all repeating rows in existence, and then set a value of a field in the main <em>Add<\/em> and <em>Edit<\/em> screen based upon what you find. An example of this is that you might have the repeating row field named RELEASE_STATUS with values of <em>New<\/em>, <em>Open<\/em> and <em>Closed<\/em>. There may be any number of repeating rows in existence with any one of these values in each repeating row. The task might be that you want to set the STATUS field on the main <em>Add<\/em> or <em>Edit<\/em> screen, to <em>New<\/em> if any repeating row has the value of <em>New<\/em>, then secondarily set the STATUS field value to <em>Open<\/em> if there is no <em>New<\/em> value on a repeating row, but at least one repeating row has the value of <em>Open<\/em>. Finally, you might then want to set the STATUS value to <em>Closed<\/em> when all the values of the repeating rows are <em>Closed<\/em>. The following rules will achieve this:<br \/>\n\t\t&nbsp;<\/p>\n<div class=\"fixedWidthFont\">\n\t\t\t&lt;== onchange ==&gt;<br \/>\n\t\t\t# First, push our changed status to the STATUS field, so we can then trigger a reset<br \/>\n\t\t\t# based on all repeating row fields, not simply the one that changed<br \/>\n\t\t\tif (RELEASE_STATUS.{changed}) {<br \/>\n\t\t\t&nbsp;&nbsp;STATUS = RELEASE_STATUS; }<br \/>\n\t\t\t# Now do the actual roll up by resetting the main status based on whether specific<br \/>\n\t\t\t# RELEASE_STATUS values exist. Note that the order of these rules is critical<br \/>\n\t\t\tif (RELEASE_STATUS = &#8216;Closed&#8217;) {<br \/>\n\t\t\t&nbsp;&nbsp;STATUS = &#8216;Closed&#8217;; }<br \/>\n\t\t\tif (RELEASE_STATUS = &#8216;Open&#8217;) {<br \/>\n\t\t\t&nbsp;&nbsp;STATUS = &#8216;Open&#8217;; }<br \/>\n\t\t\tif (RELEASE_STATUS = &#8216;New&#8217;) {<br \/>\n\t\t\t&nbsp;&nbsp;STATUS = &#8216;New&#8217;; }<br \/>\n\t\t\t&nbsp;<\/div>\n<p>\t\tThe rules are executed in order for all rows in the repeating row set. Therefore the last rule will have the last effect, setting <em>New<\/em> for the STATUS field if any repeating row has the value of <em>New<\/em> in the RELEASE_STATUS field. This progresses back up the list, so that if all repeating rows have the value of <em>Closed<\/em>, then the STATUS value is set to <em>Closed<\/em><\/li>\n<li>\n\t\tYou can execute a rule when a new row is added via the <em>Add another<\/em> button. For example, the rule:<br \/>\n\t\t&nbsp;<\/p>\n<div class=\"fixedWidthFont\">\n\t\t\t&lt;== onchange ==&gt;<br \/>\n\t\t\tif (RR_LAYOUT.{changed}) {<br \/>\n\t\t\t&nbsp;&nbsp;RR_FIELD = &#8216;value&#8217;;<br \/>\n\t\t\t}<\/div>\n<p>\n\t\tThis has the effect of setting the value of the repeating row field named RR_FIELD on all new rows that are added<\/li>\n<li>\n\t\tYou can have more finite control, and only execute rules on specific repeating rows through the use of a rule such as:<\/p>\n<div class=\"fixedWidthFont\">\n\t\t\t<br \/>\n\t\t\t&lt;== onchange ==&gt;<br \/>\n\t\t\tif (RR_LAYOUT.{changed} &amp;&amp; RR_LAYOUT.{max_row_num} = 2) {<br \/>\n\t\t\t&nbsp;&nbsp;RR_FIELD[2] = &#8216;value&#8217;;<br \/>\n\t\t\t}<\/div>\n<p>\n\t\tNote the use of <span class=\"fixedWidthFont\">max_row_num<\/span> to determine that the rule is executed only for the row being added. In this example, the rule is only triggered when the third repeating row is added, and the value of RR_FIELD is only set on the third row. Remember, the rows are numbered starting at zero, therefore the number 2 represents the 3rd row<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In general, rules are executed on repeating rows, just as they are executed on the main Add and Edit screens. However there are some important differences. The first significant difference is that a rule such as: &nbsp; &lt;== onchange ==&gt; RR_FIELD = &#8216;value&#8217;; is executed for all repeating rows in existence at the time of&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":24074,"menu_order":16,"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-24086","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; Repeating Rows - 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-repeating-rows-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Rules &amp; Repeating Rows - Product Documentation\" \/>\n<meta property=\"og:description\" content=\"In general, rules are executed on repeating rows, just as they are executed on the main Add and Edit screens. However there are some important differences. The first significant difference is that a rule such as: &nbsp; &lt;== onchange ==&gt; RR_FIELD = &#8216;value&#8217;; is executed for all repeating rows in existence at the time of...\" \/>\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-repeating-rows-1\/\" \/>\n<meta property=\"og:site_name\" content=\"Product Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-13T21:18:39+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=\"3 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-repeating-rows-1\/\",\"url\":\"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-repeating-rows-1\/\",\"name\":\"Rules & Repeating Rows - Product Documentation\",\"isPartOf\":{\"@id\":\"https:\/\/docs.extraview.com\/v25\/#website\"},\"datePublished\":\"2024-02-15T22:53:34+00:00\",\"dateModified\":\"2025-02-13T21:18:39+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-repeating-rows-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-repeating-rows-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-repeating-rows-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; Repeating Rows\"}]},{\"@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 & Repeating Rows - 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-repeating-rows-1\/","og_locale":"en_US","og_type":"article","og_title":"Rules & Repeating Rows - Product Documentation","og_description":"In general, rules are executed on repeating rows, just as they are executed on the main Add and Edit screens. However there are some important differences. The first significant difference is that a rule such as: &nbsp; &lt;== onchange ==&gt; RR_FIELD = &#8216;value&#8217;; is executed for all repeating rows in existence at the time of...","og_url":"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-repeating-rows-1\/","og_site_name":"Product Documentation","article_modified_time":"2025-02-13T21:18:39+00:00","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\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-repeating-rows-1\/","url":"https:\/\/docs.extraview.com\/v25\/extraview-25\/administration-guide-1\/site-configuration-menu-1\/business-rules-1\/writing-rules-1\/rules-repeating-rows-1\/","name":"Rules & Repeating Rows - Product Documentation","isPartOf":{"@id":"https:\/\/docs.extraview.com\/v25\/#website"},"datePublished":"2024-02-15T22:53:34+00:00","dateModified":"2025-02-13T21:18:39+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-repeating-rows-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-repeating-rows-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-repeating-rows-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; Repeating Rows"}]},{"@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\/24086","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=24086"}],"version-history":[{"count":0,"href":"https:\/\/docs.extraview.com\/v25\/wp-json\/wp\/v2\/pages\/24086\/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=24086"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}