{"id":1631,"date":"2021-11-27T14:18:31","date_gmt":"2021-11-27T14:18:31","guid":{"rendered":"https:\/\/365stack.in\/?p=1631"},"modified":"2023-06-25T09:43:48","modified_gmt":"2023-06-25T09:43:48","slug":"add-repeating-section-in-powerapps","status":"publish","type":"post","link":"https:\/\/365stack.in\/index.php\/2021\/11\/27\/add-repeating-section-in-powerapps\/","title":{"rendered":"Add repeating section in PowerApps"},"content":{"rendered":"\n<p>As we already discussed, Gallery is a multipurpose control in the canvas app. One of the use-cases of gallery is the repeating section, this scenario will be applicable between Parent-Child relationships in Lists or tables and if the form is converted from Nintex, InfoPath (OOTB repeating section control available there) to PowerApps then this post will be useful.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"141\" data-attachment-id=\"1645\" data-permalink=\"https:\/\/365stack.in\/index.php\/2021\/11\/27\/add-repeating-section-in-powerapps\/screenshot-196\/\" data-orig-file=\"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-196.png?fit=1020%2C224&amp;ssl=1?v=1637922388\" data-orig-size=\"1020,224\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-196\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-196.png?fit=300%2C66&amp;ssl=1?v=1637922388\" data-large-file=\"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-196.png?fit=640%2C141&amp;ssl=1?v=1637922388\" src=\"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-196.png?resize=640%2C141&#038;ssl=1\" alt=\"\" class=\"wp-image-1645\" srcset=\"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-196.png?w=1020&amp;ssl=1 1020w, https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-196.png?w=300&amp;ssl=1 300w, https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-196.png?w=768&amp;ssl=1 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><figcaption class=\"wp-element-caption\">Canvas App Repeating Section Implementation<\/figcaption><\/figure>\n<\/div>\n\n\n<p>With the help of other controls and formulas, repeating section can be implemented in Power Apps.<\/p>\n\n\n\n<p>Gallery needs collection or table (direct query from the table or list) as datasource. In this example, we used Dataverse as a table<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create a collection on Screen &#8220;<strong>OnVisible<\/strong>&#8221; to feed it to the gallery. We cannot use variables inside &#8220;ForAll&#8221; so &#8220;colTemp&#8221; is used as increment variable. It is used to display the S.No.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/Increment Variable\nClearCollect(colTemp,{counter:0});\n\n\/\/Gallery Data\nClear(colGalleryData);\nCollect(\n    colGalleryData,\n    ForAll(Sort(\n        Filter(\n            365Stack_ReviewData,\n            ReviewID = currentItem.ID\n        ),'Created On',Ascending),\n        {\n            stage: Stage,\n            action: Action,\n            user: User,\n            date: ReviewedDate,\n            no:Patch(colTemp,First(colTemp),{counter:Sum(First(colTemp).counter,1)}).counter,\n            ID:ID\n\n        };\n\n    )\n\n);<\/code><\/pre>\n\n\n\n<p>2. Add gallery control in the screen and map the created collection in the &#8220;Items&#8221; property. Click the edit icon and add controls inside the gallery. Each control should be mapped &#8220;ThisItem&#8221; with collection properties. For Eg: the label control is mapped with ID property from the collection. To set gallery height dynamically use the following formula.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n<strong>Items<\/strong>: colGalleryData\n\/\/To adjust the gallery height dynamically\nHeight: Self.TemplateHeight * CountRows(Self.AllItems) + 60<\/code><\/pre>\n\n\n\n<div class=\"wp-block-jetpack-slideshow\" data-effect=\"slide\"><div class=\"wp-block-jetpack-slideshow_container swiper-container\"><ul class=\"wp-block-jetpack-slideshow_swiper-wrapper swiper-wrapper\"><li class=\"wp-block-jetpack-slideshow_slide swiper-slide\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"240\" alt=\"\" class=\"wp-block-jetpack-slideshow_image wp-image-1646\" data-id=\"1646\" src=\"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-218-1024x384.png?resize=640%2C240&#038;ssl=1\" srcset=\"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-218.png?w=1024&amp;ssl=1 1024w, https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-218.png?w=300&amp;ssl=1 300w, https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-218.png?w=768&amp;ssl=1 768w, https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-218.png?w=1369&amp;ssl=1 1369w, https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-218.png?w=1280&amp;ssl=1 1280w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/figure><\/li><li class=\"wp-block-jetpack-slideshow_slide swiper-slide\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"287\" alt=\"\" class=\"wp-block-jetpack-slideshow_image wp-image-1647\" data-id=\"1647\" src=\"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-219.png?resize=640%2C287&#038;ssl=1\" srcset=\"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-219.png?w=939&amp;ssl=1 939w, https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-219.png?w=300&amp;ssl=1 300w, https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-219.png?w=768&amp;ssl=1 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/figure><\/li><\/ul><a class=\"wp-block-jetpack-slideshow_button-prev swiper-button-prev swiper-button-white\" role=\"button\"><\/a><a class=\"wp-block-jetpack-slideshow_button-next swiper-button-next swiper-button-white\" role=\"button\"><\/a><a aria-label=\"Pause Slideshow\" class=\"wp-block-jetpack-slideshow_button-pause\" role=\"button\"><\/a><div class=\"wp-block-jetpack-slideshow_pagination swiper-pagination swiper-pagination-white\"><\/div><\/div><\/div>\n\n\n\n<p>3. Added rows can be deleted, So the delete option is provided. The record has to be deleted from the collection then it has to be deleted from the list or table and the S.No has to be updated in the collection because if any in between record is deleted remaining numbers have to be re-arranged.<\/p>\n\n\n\n<div class=\"wp-block-jetpack-slideshow\" data-effect=\"slide\"><div class=\"wp-block-jetpack-slideshow_container swiper-container\"><ul class=\"wp-block-jetpack-slideshow_swiper-wrapper swiper-wrapper\"><li class=\"wp-block-jetpack-slideshow_slide swiper-slide\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"164\" alt=\"\" class=\"wp-block-jetpack-slideshow_image wp-image-1648\" data-id=\"1648\" src=\"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-197-1024x262.png?resize=640%2C164&#038;ssl=1\" srcset=\"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-197.png?w=1024&amp;ssl=1 1024w, https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-197.png?w=300&amp;ssl=1 300w, https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-197.png?w=768&amp;ssl=1 768w, https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-197.png?w=1045&amp;ssl=1 1045w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/figure><\/li><li class=\"wp-block-jetpack-slideshow_slide swiper-slide\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"138\" alt=\"\" class=\"wp-block-jetpack-slideshow_image wp-image-1649\" data-id=\"1649\" src=\"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-198.png?resize=640%2C138&#038;ssl=1\" srcset=\"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-198.png?w=1015&amp;ssl=1 1015w, https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-198.png?w=300&amp;ssl=1 300w, https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-198.png?w=768&amp;ssl=1 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/figure><\/li><\/ul><a class=\"wp-block-jetpack-slideshow_button-prev swiper-button-prev swiper-button-white\" role=\"button\"><\/a><a class=\"wp-block-jetpack-slideshow_button-next swiper-button-next swiper-button-white\" role=\"button\"><\/a><a aria-label=\"Pause Slideshow\" class=\"wp-block-jetpack-slideshow_button-pause\" role=\"button\"><\/a><div class=\"wp-block-jetpack-slideshow_pagination swiper-pagination swiper-pagination-white\"><\/div><\/div><\/div>\n\n\n\n<p>Use the below formula in Delete icon OnClick<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\/\/Reset Counter variable\nClearCollect(\n    colTemp,\n    {counter: 0}\n);\n\n\/\/Remove the record from collection\nRemoveIf(\n    colGalleryData,\n    no = ThisItem.no\n);\n\n\/\/Remove the record from table or list\nIf(!IsBlank(lblID.Text),RemoveIf(365Stack_ReviewData,ID = lblID.Text));\n\n\/\/Update the S.No in collection and increment the counter\nForAll(\n    gal365Stack_ReviewData.AllItems,\n    UpdateIf(\n        colGalleryData,\n        no = Value(lblSno.Text),\n        {no: Sum(First(colTemp).counter,1)}\n    );\n    Patch(colTemp,First(colTemp),{counter:Sum(First(colTemp).counter,1)})   \n)<\/code><\/pre>\n\n\n\n<p>4. Need to provide an option to add a record in the gallery. For this, we need to use the patch function to add empty rows to the collection. <\/p>\n\n\n\n<p>In Add Rows Icon<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Patch(colGalleryData,Defaults(colGalleryData),{no:Sum(CountRows(gal365Stack_ReviewData.AllItems),1),stage:\"\",action:\"\",user:\"\",date:Now()})<\/code><\/pre>\n\n\n\n<p>5. Next step is to save the gallery data, In this case, we are not saving on each row processing. All the gallery data is saved in one button link. Here we are checking whether the data is already present in the table, if it is there update patch will be called otherwise it will create a new record.<\/p>\n\n\n\n<p>On Form Save<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/Loop gallery data and save the data.\nForAll(\n        gal365Stack_ReviewData.AllItems As gal,\n        If(\n            IsBlank(gal.lblID.Text),\n            Patch(\n                365Stack_ReviewData,\n                Defaults(365Stack_ReviewData),\n                {\n                    Stage: lblStage.Text,\n                    User: cmbUser.Selected.Mail,\n                    Action: txtAction.Text,\n                    Date: dtDate.SelectedDate\n                }\n            ),\n            Patch(\n                365Stack_ReviewData,\n                LookUp(\n                    365Stack_ReviewData,\n                    ID = Value(gal.lblID.Text)\n                ),\n                {\n                    Stage: lblStage.Text,\n                    User: cmbUser.Selected.Mail,\n                    Action: txtAction.Text,\n                    Date: dtDate.SelectedDate\n                }\n            )\n        )\n    )<\/code><\/pre>\n\n\n\n<p>This post might be hard to digest because there are more formulas are used and other controls are shown in the screenshot which itself can be created as a separate post. For Eg: People Picker control in the Canvas app, Difference between Patch, UpdateIf functions, ForAll usage, Collection usage, Query formulas, gallery usage. <\/p>\n\n\n\n<p>Please post your queries in the comments. Happy building \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As we already discussed, Gallery is a multipurpose control in the canvas app. One of the use-cases of gallery is the repeating section, this scenario will be applicable between Parent-Child relationships in Lists or tables and if the form is converted from Nintex, InfoPath (OOTB repeating section control available there) to PowerApps then this post will be useful. With the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1648,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[6,32,5],"tags":[12,27,46,33,9,58],"class_list":["post-1631","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-canvas-apps","category-power-platform","category-powerapps","tag-canvas-app","tag-gallery","tag-microsoft-365","tag-power-platform","tag-powerapps","tag-repeating-section"],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-197.png?fit=1045%2C267&ssl=1?v=1637926841","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1139,"url":"https:\/\/365stack.in\/index.php\/2021\/06\/09\/how-to-perform-both-filter-and-search-in-gallery-using-power-apps\/","url_meta":{"origin":1631,"position":0},"title":"How To Perform Both Filter And Search In Gallery Using PowerApps","author":"Kanagaraj Neelamegan","date":"June 9, 2021","format":"video","excerpt":"Perform Search and Filter together in Gallery control. https:\/\/youtu.be\/TSj35fiDjqQ","rel":"","context":"In &quot;Canvas Apps&quot;","block_context":{"text":"Canvas Apps","link":"https:\/\/365stack.in\/index.php\/category\/power-platform\/powerapps\/canvas-apps\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/06\/FilterSearch.png?fit=1200%2C541&ssl=1%3Fv%3D1623349368&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1232,"url":"https:\/\/365stack.in\/index.php\/2021\/07\/04\/how-to-build-responsive-gallery-using-powerapps-canvas-app\/","url_meta":{"origin":1631,"position":1},"title":"How To Build Responsive Gallery using PowerApps | Canvas App","author":"Kanagaraj Neelamegan","date":"July 4, 2021","format":false,"excerpt":"Lets create responsive card view using gallery control in power apps.","rel":"","context":"In &quot;Canvas Apps&quot;","block_context":{"text":"Canvas Apps","link":"https:\/\/365stack.in\/index.php\/category\/power-platform\/powerapps\/canvas-apps\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/07\/Responsivegallery.png?fit=1037%2C766&ssl=1%3Fv%3D1625418734&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1148,"url":"https:\/\/365stack.in\/index.php\/2021\/06\/09\/how-to-use-gallery-control-in-powerapps\/","url_meta":{"origin":1631,"position":2},"title":"How To Use Gallery Control In PowerApps","author":"Kanagaraj Neelamegan","date":"June 9, 2021","format":false,"excerpt":"Post will guide how to create card view using Gallery control.","rel":"","context":"In &quot;Canvas Apps&quot;","block_context":{"text":"Canvas Apps","link":"https:\/\/365stack.in\/index.php\/category\/power-platform\/powerapps\/canvas-apps\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/06\/GalleryControlTumbnail.png?fit=900%2C628&ssl=1%3Fv%3D1623349368&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1527,"url":"https:\/\/365stack.in\/index.php\/2021\/11\/21\/how-to-create-custom-attachment-control-in-powerapps\/","url_meta":{"origin":1631,"position":3},"title":"How to create custom attachment control in PowerApps","author":"Hemanthkumar Rajan","date":"November 21, 2021","format":false,"excerpt":"Attaching a file along with the form is a common requirement, By default PowerApps does not provide any attachment control. But if the SharePoint list is added as a datasource automatically the attachment control will be generated along with the controls. But if multiple attachment control has to be shown\u2026","rel":"","context":"In &quot;Canvas Apps&quot;","block_context":{"text":"Canvas Apps","link":"https:\/\/365stack.in\/index.php\/category\/power-platform\/powerapps\/canvas-apps\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-143.png?fit=1200%2C467&ssl=1%3Fv%3D1637483532&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2278,"url":"https:\/\/365stack.in\/index.php\/2021\/12\/28\/how-to-send-json-data-to-canvas-apps\/","url_meta":{"origin":1631,"position":4},"title":"How to send JSON data to Canvas Apps","author":"Premkumar Perumal","date":"December 28, 2021","format":false,"excerpt":"We're going to explain how to send a JSON response from Power Automate to Canvas app and how to convert the response into Collection format in Canvas app. To illustrate, we have explained a small app as example. As First step, create a new Instant flow that can be triggered\u2026","rel":"","context":"In &quot;Canvas Apps&quot;","block_context":{"text":"Canvas Apps","link":"https:\/\/365stack.in\/index.php\/category\/power-platform\/powerapps\/canvas-apps\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/12\/Screenshot-2021-12-28-103100.png?fit=836%2C391&ssl=1%3Fv%3D1640667678&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1801,"url":"https:\/\/365stack.in\/index.php\/2021\/11\/28\/how-to-create-nested-gallery-in-power-apps\/","url_meta":{"origin":1631,"position":5},"title":"How to create Nested Gallery in Power Apps","author":"Premkumar Perumal","date":"November 28, 2021","format":false,"excerpt":"Let's try to build a PowerApps's Nested gallery view using GroupBy function to achieve the Grouping functionality of SharePoint List We have used below sample data in Collection as a data source for the galleries used in this Nested Gallery Application and we can also use any data source to\u2026","rel":"","context":"In &quot;Canvas Apps&quot;","block_context":{"text":"Canvas Apps","link":"https:\/\/365stack.in\/index.php\/category\/power-platform\/powerapps\/canvas-apps\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/365stack.in\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-28-183835-e1638106039601.png?fit=872%2C424&ssl=1%3Fv%3D1638104932&resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/365stack.in\/index.php\/wp-json\/wp\/v2\/posts\/1631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/365stack.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/365stack.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/365stack.in\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/365stack.in\/index.php\/wp-json\/wp\/v2\/comments?post=1631"}],"version-history":[{"count":6,"href":"https:\/\/365stack.in\/index.php\/wp-json\/wp\/v2\/posts\/1631\/revisions"}],"predecessor-version":[{"id":2492,"href":"https:\/\/365stack.in\/index.php\/wp-json\/wp\/v2\/posts\/1631\/revisions\/2492"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/365stack.in\/index.php\/wp-json\/wp\/v2\/media\/1648"}],"wp:attachment":[{"href":"https:\/\/365stack.in\/index.php\/wp-json\/wp\/v2\/media?parent=1631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/365stack.in\/index.php\/wp-json\/wp\/v2\/categories?post=1631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/365stack.in\/index.php\/wp-json\/wp\/v2\/tags?post=1631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}