{"blocks":[{"id":"928E15DC-18F7-4F4F-B3C2-EE35AEC70BDD","type":"StartBlock","x":387,"y":49,"disabled":false,"name":"AppReloadFinished","displayName":"App Reload Finished","comment":"","childId":"2071DA36-E708-4D17-AACD-146B81BE9889","inputs":[{"id":"run_mode","value":"webhook","type":"select","structure":{}},{"id":"datasourcetype_guid","value":"61a87510-c7a3-11ea-95da-0fb0c241e75c","type":"select","displayValue":"Qlik Cloud Services","structure":[]},{"id":"webhook_event_guid","value":"2ad48ec0-889f-11eb-91d9-d92131915ff0","type":"select","displayValue":"App Reload Finished","structure":[]},{"id":"test_payload","value":"{\n  \"cloudEventsVersion\": \"0.1\",\n  \"source\": \"com.qlik/engine\",\n  \"contentType\": \"application/json\",\n  \"eventId\": \"dd986bbf-40ab-44a8-be80-3bf5e06a55ee\",\n  \"eventTime\": \"2021-09-17T09:14:05Z\",\n  \"eventTypeVersion\": \"1.0.0\",\n  \"eventType\": \"com.qlik.v1.app.reload.finished\",\n  \"extensions\": {\n    \"tenantId\": \"KuGA12XZN0c7A7MUGHTkJuXGx3QVwrdo\",\n    \"userId\": \"5-dSP_g22ekR3CivrMwXl-IeM-2h0-AD\",\n    \"topLevelResourceId\": \"SessionApp_WkNBbJLEubECrAG3EfRFG8_tyG1Xp8yO\"\n  },\n  \"data\": {\n    \"duration\": 295,\n    \"endTime\": \"2021-09-17T09:14:05.131Z\",\n    \"errors\": [],\n    \"id\": \"8ab67d4a-9713-47e4-b5f7-60f3e0c16a65\",\n    \"name\": \"\",\n    \"peakMemoryBytes\": 4208512,\n    \"reloadId\": \"9c4ad0b7-6e65-496f-addb-65e0ea04dcef\",\n    \"size\": {\n      \"memory\": 208\n    },\n    \"status\": \"ok\",\n    \"warnings\": []\n  }\n}","type":"json","structure":[]},{"id":"webhook_documentation","value":null,"type":"string","structure":{}}],"settings":[],"collapsed":[{"name":"loop","isCollapsed":false}],"logo":"https://cdn.qlikcloud.com/automations/logos/21dd4ad9985d490e7bfd7a644d783489.png"},{"id":"3700AB77-73D0-47CA-A6AD-433173155860","type":"SnippetBlock","x":646,"y":704,"disabled":false,"name":"LoopAndReduce","displayName":"Qlik Cloud Services - Loop And Reduce","comment":"","childId":null,"inputs":[{"id":"0e48c2e0-f086-11eb-ba8e-09484ed49568","value":"{$.AppReloadFinished.data.id}","type":"string","structure":[]},{"id":"0e496710-f086-11eb-a5e1-dd4d86372e41","value":"{$.listDimensions.item.qMeta.title}","type":"string","structure":[]}],"settings":[{"id":"blendr_on_error","value":"stop","type":"select","structure":[]}],"collapsed":[{"name":"loop","isCollapsed":false}],"loopBlockId":"FA733FB4-442C-4EE4-A557-0C5E0C5449E3","datasourcetype_guid":"61a87510-c7a3-11ea-95da-0fb0c241e75c","snippet_guid":"20058380-cf52-11eb-b7f1-e7b34d42f743","snippet":{"guid":"20058380-cf52-11eb-b7f1-e7b34d42f743","name":"loop and reduce","description":"The **Loop And Reduce** block will reduce an app according to a field. Each reduced app is stored on the temporary file services and this block will return a list of the corresponding ids that point to the temporary file services. Each object in the returned list will also contain a list of sheet ids of sheets that are public in the source app.\n\nUse the block **Distribute Reduced App To Managed Space** in the loop created by this block to import and distribute the reduced apps one by one to a managed space in QCS.\n\nMore information regarding the raw endpoint for this block is available [here](https://community.qlik.com/t5/Knowledge/How-to-Loop-and-reduce-with-Qlik-Application-Automation/ta-p/1834378)\n\nThis block is experimental and subject to changes.","snippet_datasource_id":null,"snippet_example_output":[{"exportId":"6137669a7b55a400015e7d40","publicSheets":["XkgjPf","VXmZj","dd739947-c9ef-4c79-9914-e4612217ad63"],"reducedValue":"Scotland"},{"exportId":"6137669cf0ccf200019934c8","publicSheets":["XkgjPf","VXmZj","dd739947-c9ef-4c79-9914-e4612217ad63"],"reducedValue":"Northern Ireland"},{"exportId":"6137669f7b55a400015e7d41","publicSheets":["XkgjPf","VXmZj","dd739947-c9ef-4c79-9914-e4612217ad63"],"reducedValue":"England"},{"exportId":"613766a2f0ccf200019934ca","publicSheets":["XkgjPf","VXmZj","dd739947-c9ef-4c79-9914-e4612217ad63"],"reducedValue":"Wales"},{"exportId":"613766a438cede00010fc593","publicSheets":["XkgjPf","VXmZj","dd739947-c9ef-4c79-9914-e4612217ad63"],"reducedValue":"Guernsey"},{"exportId":"613766a638cede00010fc595","publicSheets":["XkgjPf","VXmZj","dd739947-c9ef-4c79-9914-e4612217ad63"],"reducedValue":"Isle of Man"},{"exportId":"613766a97b55a400015e7d47","publicSheets":["XkgjPf","VXmZj","dd739947-c9ef-4c79-9914-e4612217ad63"],"reducedValue":"Jersey"}],"snippet_endpoint_id":null,"role":"list","status":"live","inputs":[{"id":65,"guid":"0e48c2e0-f086-11eb-ba8e-09484ed49568","prompt":"app_id","help_text":"\"do lookup\" retrieves first 500 apps.","type":"input","values":"","options":{"lookup_snippet_guid":"2af78370-0bc2-11ec-bca8-29eaabadff6d"},"is_required":true,"order":0},{"id":66,"guid":"0e496710-f086-11eb-a5e1-dd4d86372e41","prompt":"reduction_field","help_text":"Select the field that should be used to reduce the app to.","type":"input","values":"","options":{"lookup_snippet_guid":"c74da3c0-269e-11eb-957f-ddb1fc0c5b29"},"is_required":true,"order":1}],"objecttype":"apps"}},{"id":"FA733FB4-442C-4EE4-A557-0C5E0C5449E3","type":"EndpointBlock","x":1021,"y":1318,"disabled":false,"name":"importAppFromExportId","displayName":"Qlik Cloud Services - Import App From Export Id","comment":"","childId":null,"inputs":[{"id":"b42dd920-8644-11eb-b6ed-dfd85924e9a7","value":"{$.LoopAndReduce.item.exportId}","type":"string","structure":[]},{"id":"b4186080-8644-11eb-a660-c55d57459f04","value":"{$.AppReloadFinished.data.name}_{$.LoopAndReduce.item.reducedValue}","type":"string","structure":[]},{"id":"b41d3060-8644-11eb-ba43-fd69a2baeb57","value":"{ $.listVariables }","type":"string","structure":[]},{"id":"b42382f0-8644-11eb-b407-95a158406ff6","value":"{$.listVariables[?(@.qName=='TargetSpace')].qDefinition}","type":"select","structure":[]},{"id":"b428dca0-8644-11eb-b4ad-b9bcc351fb58","value":null,"type":"string","structure":[]}],"settings":[{"id":"blendr_on_error","value":"stop","type":"select","structure":[]}],"collapsed":[{"name":"loop","isCollapsed":false}],"datasourcetype_guid":"61a87510-c7a3-11ea-95da-0fb0c241e75c","endpoint_guid":"b40774a0-8644-11eb-b3fb-097c18c5fa48","endpoint_role":"create"},{"id":"7C5D2FE7-19EE-4EC4-AC9E-0A4210F5C7CF","type":"IfElseBlock","x":486,"y":498,"disabled":false,"name":"condition","displayName":"Condition","comment":"","childId":null,"inputs":[{"id":"conditions","value":{"mode":"all","conditions":[{"input1":"{$.listDimensions.item.qMeta.tags}","input2":"LR","operator":"contain"}]},"type":"custom","structure":[]}],"settings":[],"collapsed":[{"name":"yes","isCollapsed":false},{"name":"no","isCollapsed":false}],"childTrueId":"3700AB77-73D0-47CA-A6AD-433173155860","childFalseId":null},{"id":"63F2EB3D-14ED-438B-AE34-65264948A37E","type":"SnippetBlock","x":407,"y":417,"disabled":false,"name":"listDimensions","displayName":"Qlik Cloud Services - List Dimensions","comment":"","childId":null,"inputs":[{"id":"ffb04c70-1788-11ec-867c-51f3d367e187","value":"{$.AppReloadFinished.data.id}","type":"string","structure":[]}],"settings":[{"id":"blendr_on_error","value":"stop","type":"select","structure":[]}],"collapsed":[{"name":"loop","isCollapsed":false}],"loopBlockId":"7C5D2FE7-19EE-4EC4-AC9E-0A4210F5C7CF","datasourcetype_guid":"61a87510-c7a3-11ea-95da-0fb0c241e75c","snippet_guid":"da689620-1565-11ec-bd4b-03a9e76b0c5e","snippet":{"guid":"da689620-1565-11ec-bd4b-03a9e76b0c5e","name":"list dimensions","description":null,"snippet_datasource_id":null,"snippet_example_output":[{"qData":[],"qInfo":{"qId":"a0d5cdd6-d860-48e5-bb6f-6b27ea65ae28","qType":"dimension"},"qMeta":{"tags":[],"title":"Account Number","privileges":["read","update","delete","publish"],"description":null}}],"snippet_endpoint_id":null,"role":"list","status":"live","inputs":[{"id":226,"guid":"ffb04c70-1788-11ec-867c-51f3d367e187","prompt":"app_id","help_text":"\"do lookup\" retrieves first 500 apps.","type":"input","values":"","options":{"lookup_snippet_guid":"2af78370-0bc2-11ec-bca8-29eaabadff6d"},"is_required":true,"order":0}],"objecttype":"apps"}},{"id":"2071DA36-E708-4D17-AACD-146B81BE9889","type":"SnippetBlock","x":377,"y":141,"disabled":false,"name":"listVariables","displayName":"Qlik Cloud Services - List Variables","comment":"","childId":"63F2EB3D-14ED-438B-AE34-65264948A37E","inputs":[{"id":"454b0e00-fbac-11eb-84b8-557fe5b7be4a","value":"{$.AppReloadFinished.data.id}","type":"string","structure":[]}],"settings":[{"id":"blendr_on_error","value":"stop","type":"select","structure":[]}],"collapsed":[{"name":"loop","isCollapsed":false}],"loopBlockId":null,"datasourcetype_guid":"61a87510-c7a3-11ea-95da-0fb0c241e75c","snippet_guid":"4e90ba10-eee4-11eb-90ec-296dfb07d770","snippet":{"guid":"4e90ba10-eee4-11eb-90ec-296dfb07d770","name":"list variables","description":null,"snippet_datasource_id":null,"snippet_example_output":[{"qData":[],"qInfo":{"qId":"355e5ef6-6fae-46af-9dc5-1f6b96bd3973","qType":"variable"},"qMeta":{"privileges":["read","update","delete"]},"qName":"CountryCount","qDefinition":"=Count(Country)","qDescription":"test"},{"qData":[],"qInfo":{"qId":"355e5ef6-6fae-46af-9dc5-XXXXXXXXXX","qType":"variable"},"qMeta":{"privileges":["read","update","delete"]},"qName":"CountrySum","qDefinition":"=Sum(Country)","qDescription":"Sum of country"}],"snippet_endpoint_id":null,"role":"list","status":"live","inputs":[{"id":87,"guid":"454b0e00-fbac-11eb-84b8-557fe5b7be4a","prompt":"app_id","help_text":"\"do lookup\" retrieves first 500 apps.","type":"input","values":"","options":{"lookup_snippet_guid":"2af78370-0bc2-11ec-bca8-29eaabadff6d"},"is_required":true,"order":0}],"objecttype":"apps"}}],"variables":[{"guid":"0891F3D7-FC68-43E5-AD76-0616CAFC0AF9","name":"DimensionToLoop","type":"list"},{"guid":"E9632B61-F57F-4DAF-BF39-9F23204B86D7","name":"AppsToReduce","type":"object"},{"guid":"14B28CB5-BA0B-463B-9788-959E404B4436","name":"AppSpaceMapping","type":"object"},{"guid":"E83659A2-2B4F-4F9B-A678-0404DDD0993F","name":"SpaceId","type":"string"}]}