Better.
Will combine all the text keys inside the primary_content array with comma (,) as a delimiter.
You don’t need iterators unless you want the scenario to iterate each element of an array. the map() function when used properly and you understand the syntax is very powerful. Unfortunately you must understand all the nuances of how it works and for that you need to read the docs or try my Make for Newbies video series.
I put together a little tester scenario for you to try. To install the scenario blueprint (JSON) I made follow these steps:
Your new scenario will now have all the modules I used to simulate an attempt at a solution to your question. You may need to confirm the configuration or reselect connections of each imported module in the scenario.
Scenario Blueprint
{
"subflows": [
{
"flow": [
{
"id": 1,
"module": "json:ParseJSON",
"version": 1,
"parameters": {
"type": ""
},
"mapper": {
"json": "[\n {\n \"array\": [\n {\n \"h_title\": \"Search for clinical information on drugs and medical devices\",\n \"main_title\": \"Search for clinical information on drugs and medical devices\",\n \"primary_content\": [\n {\n \"text\": \"Content and search results on this site are in the language provided by the manufacturer. Access and use of clinical information is governed by the Terms of Use.\",\n \"url\": \"https://clinical-information.canada.ca/ci-rc/terms\",\n \"urls\": [\n {\n \"url\": \"https://clinical-information.canada.ca/ci-rc/terms\",\n \"anchor_text\": \"Terms of Use\"\n }\n ]\n }\n ]\n },\n {\n \"h_title\": \"Don't see what you're looking for?\",\n \"main_title\": \"Search for clinical information on drugs and medical devices\",\n \"primary_content\": [\n {\n \"text\": \"Still don’t see what you’re looking for? You can request clinical information for a drug or a medical device.\",\n \"url\": \"https://clinical-information.canada.ca/request-drug-clinical-information\",\n \"urls\": [\n {\n \"url\": \"https://clinical-information.canada.ca/request-drug-clinical-information\",\n \"anchor_text\": \"drug\"\n },\n {\n \"url\": \"https://clinical-information.canada.ca/request-device-clinical-information\",\n \"anchor_text\": \"medical device\"\n }\n ]\n }\n ]\n },\n {\n \"h_title\": \"Drug records\",\n \"main_title\": \"Search for clinical information on drugs and medical devices\",\n \"primary_content\": [\n {\n \"text\": \"MEASLES VIRUS VACCINE LIVE ATTENUATED\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"MUMPS VIRUS VACCINE LIVE ATTENUATED\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RUBELLA VIRUS VACCINE LIVE ATTENUATED\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"ANTIHEMOPHILIC FACTOR VIII (RECOMBINANT, B-DOMAIN TRUNCATED), PEGYLATED\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RECOMBINANT HUMAN PAPILLOMAVIRUS TYPE 6 L1 PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RECOMBINANT HUMAN PAPILLOMAVIRUS TYPE 11 L1 PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RECOMBINANT HUMAN PAPILLOMAVIRUS TYPE 16 L1 PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RECOMBINANT HUMAN PAPILLOMAVIRUS TYPE 18 L1 PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RECOMBINANT HUMAN PAPILLOMAVIRUS TYPE 31 L1 PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RECOMBINANT HUMAN PAPILLOMAVIRUS TYPE 33 L1 PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RECOMBINANT HUMAN PAPILLOMAVIRUS TYPE 45 L1 PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RECOMBINANT HUMAN PAPILLOMAVIRUS TYPE 52 L1 PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RECOMBINANT HUMAN PAPILLOMAVIRUS TYPE 58 L1 PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"DIPHTHERIA TOXOID 25 LF / 0.5 ML\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"FILAMENTOUS HAEMAGGLUTININ 25 MCG / 0.5 ML\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"HAEMOPHILUS INFLUENZAE TYPE B-PRP 10 MCG / 0.5 ML\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"HEPATITIS B SURFACE ANTIGEN (RECOMBINANT) 10 MCG / 0.5 ML\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"INACTIVATED POLIOVIRUS TYPE I 40 UNIT / 0.5 ML\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"INACTIVATED POLIOVIRUS TYPE II 8 UNIT / 0.5 ML\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"INACTIVATED POLIOVIRUS TYPE III 32 UNIT / 0.5 ML\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PERTUSSIS TOXOID 25 MCG / 0.5 ML\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"TETANUS TOXOID 10 LF / 0.5 ML\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"TETANUS TOXOID ADSORBED 40 MCG / 0.5 ML\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"MEASLES VIRUS VACCINE LIVE ATTENUATED 1000 UNIT / 0.5 ML\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"MUMPS VIRUS VACCINE LIVE ATTENUATED (JERYL LYNN STRAIN) 10000 UNIT / 0.5 ML\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RUBELLA VIRUS VACCINE LIVE ATTENUATED (WISTAR RA27/3 STRAIN) 1000 UNIT / 0.5 ML\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"INACTIVATED POLIOMYELITIS VACCINE (V.C.O.) TYPE 1 MAHONEY\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"INACTIVATED POLIOMYELITIS VACCINE (D.C.O.) TYPE 2 MEF1\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"INACTIVATED POLIOMYELITIS VACCINE (V.C.O.) TYPE 3 SAUKETT\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RECOMBINANT HAEMAGGLUTININ PROTEIN-STRAIN A(H1N1)\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RECOMBINANT HAEMAGGLUTININ PROTEIN-STRAIN A(H3N2)\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RECOMBINANT HAEMAGGLUTININ PROTEIN-STRAIN B (VICTORIA)\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"CORYNEBACTERIUM DIPHTHERIAE CRM-197 PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"ALFA 1-PROTEINASE INHIBITOR (HUMAN)\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"VIRUS-LIKE PARTICLES (VLP) OF SARS-COV-2 SPIKE PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"SARS-COV-2 RECOMBINANT SPIKE PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"BACILLUS CALMETTE-GUÉRIN (BCG) - STRAIN RUSSIAN BCG-I\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 1, 3, 4, 5, 6A, 6B, 7F, 8, 9V, 10A, 11A, 12F, 14, 15B, 18C, 19A, 19F, 22F, 23F, and 33F\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"LUTETIUM (177LU) VIPIVOTIDE TETRAXETAN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"FIMBRIAE TYPES 2 AND 3 (FIM)\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"INACTIVATED POLIOMYELITIS VACCINE (D.C.O) TYPE 1 MAHONEY\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"INACTIVATED POLIOMYELITIS VACCINE (D.C.O.) TYPE 2 M.E.F.1\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"INACTIVATED POLIOMYELITIS VACCINE (D.C.O.) TYPE 3 SAUKETT\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"HEPATITIS B SURFACE ANTIGEN (RECOMBINANT)\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"ANTIHEMOPHILIC FACTOR (RECOMBINANT BDD), FC FUSION PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"COAGULATION FACTOR IX (RECOMBINANT), PEGYLATED\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 1, 3,4, 5, 6A, 6B, 7F, 9V, 14, 18C, 19A, 22F, 23F, 33F\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"INACTIVATED POLIOMYELITIS VACCINE (V.C.O.) TYPE 2 MEF1\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"HAEMOPHILUS INFLUENZAE TYPE B-PRP\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"NEISSERIA MENINGITIDIS GRP B RECOMBINANT LIPOPROTEIN 2086 SUBFAMILY A\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"NEISSERIA MENINGITIDIS GRP B RECOMBINANT LIPOPROTEIN 2086 SUBFAMILY B\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"COAGULATION FACTOR IX (HUMAN)\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 6A\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 6B\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 7F\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 9V\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 18C\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 19A\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 19F\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 22F\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 23F\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 33F\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"EBOLA ZAIRE VACCINE (RVSV [DELTA] G-ZEBOV-GP, LIVE)\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"MENINGOCOCCAL POLYSACCHARIDE ANTIGEN GROUP A\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"MENINGOCOCCAL POLYSACCHARIDE ANTIGEN GROUP C\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"MENINGOCOCCAL POLYSACCHARIDE ANTIGEN GROUP W-135\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"MENINGOCOCCAL POLYSACCHARIDE ANTIGEN GROUP Y\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 1, 3*, 4*, 5* ,6A* ,6B*, 7F*, 8* ,9V* ,10A* ,11A* ,12F* ,14*, 15B* ,18C* ,19A* ,19F*, 22F* ,23F* ,33F\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 10A\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 11A\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 12F\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"PNEUMOCOCCAL POLYSACCHARIDE SEROTYPE 15B\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RSV SUBGROUP A STABILIZED PREFUSION F PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"RSV SUBGROUP B STABILIZED PREFUSION F PROTEIN\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"COAGULATION FACTOR IX (RECOMBINANT), ALBUMIN FUSION PROTEIN (RIX-FP)\",\n \"url\": null,\n \"urls\": null\n },\n {\n \"text\": \"VIBRIO CHOLERAE, STRAIN CVD 103-HGR, LIVE\",\n \"url\": null,\n \"urls\": null\n }\n ]\n },\n {\n \"h_title\": \"Don't see what you're looking for?\",\n \"main_title\": \"Search for clinical information on drugs and medical devices\",\n \"primary_content\": [\n {\n \"text\": \"Still don’t see what you’re looking for? You can request clinical information for a drug or a medical device.\",\n \"url\": \"https://clinical-information.canada.ca/request-drug-clinical-information\",\n \"urls\": [\n {\n \"url\": \"https://clinical-information.canada.ca/request-drug-clinical-information\",\n \"anchor_text\": \"drug\"\n },\n {\n \"url\": \"https://clinical-information.canada.ca/request-device-clinical-information\",\n \"anchor_text\": \"medical device\"\n }\n ]\n }\n ]\n },\n {\n \"h_title\": \"Thank you for your help!\",\n \"main_title\": \"Search for clinical information on drugs and medical devices\",\n \"primary_content\": [\n {\n \"text\": \"You will not receive a reply. For enquiries, contact us.\",\n \"url\": \"https://www.canada.ca/en/contact/index.html\",\n \"urls\": [\n {\n \"url\": \"https://www.canada.ca/en/contact/index.html\",\n \"anchor_text\": \"contact us\"\n }\n ]\n }\n ]\n }\n ],\n \"__IMTAGGLENGTH__\": 5\n }\n]"
},
"metadata": {
"designer": {
"x": 0,
"y": 0
},
"restore": {
"parameters": {
"type": {
"label": "Choose a data structure"
}
}
},
"parameters": [
{
"name": "type",
"type": "udt",
"label": "Data structure"
}
],
"expect": [
{
"name": "json",
"type": "text",
"label": "JSON string",
"required": true
}
]
}
},
{
"id": 2,
"module": "util:SetVariables",
"version": 1,
"parameters": {},
"mapper": {
"variables": [
{
"name": "text",
"value": "{{join(map(1.array; \"primary_content[].text\"); \",\")}}"
}
],
"scope": "roundtrip"
},
"metadata": {
"designer": {
"x": 300,
"y": 0
},
"restore": {
"expect": {
"variables": {
"items": [
null
]
},
"scope": {
"label": "One cycle"
}
}
},
"expect": [
{
"name": "variables",
"type": "array",
"label": "Variables",
"spec": [
{
"name": "name",
"label": "Variable name",
"type": "text",
"required": true
},
{
"name": "value",
"label": "Variable value",
"type": "any"
}
]
},
{
"name": "scope",
"type": "select",
"label": "Variable lifetime",
"required": true,
"validate": {
"enum": [
"roundtrip",
"execution"
]
}
}
],
"interface": [
{
"name": "text",
"label": "text",
"type": "any"
}
]
}
}
]
}
],
"metadata": {
"version": 1
}
}