I am undertaking a little exercise to explain the core features of Make using a scenario walkthrough and a related video. My hope is to record videos between 5-30 minutes long to explain Make to Make Newbies.
Aug 2024 UPDATE:
HERE IS THE FULL MAKE FOR MAKE NEWBIES VIDEO SERIES IN 1 WEB PAGE
I am going to start with a topic which I think confuses just about everyone who starts using Make but has never programmed before:
Part 1: Exploring Data Structures for Make Newbies
In this video and accompanying scenario we will review simple arrays and more complex collections and arrays of collections. The interaction between the number of elements in an array and how bundles are created is also covered. Iterators are covered which can loop an array and generate processing loops in scenarios. The Parse JSON
module is also introduced which is useful for parsing text which contains JSON into Make-friendly data structures. By the way JSON, is JavaScript Object Notation, and it is the “lingua-franca” of all data that is passed between modules of a Make scenario. It is also the structure of how most online apps expect data to sent via APIs. I highly recommend you get comfortable with JSON!
And here’s a tip for creating your own JSON: sample JSON can be created in ChatGPT just by describing the type of JSON you want in plain text. If you have some JSON you wrote and want to validate or pretty up the format, use JSONLint.
https://vimeo.com/newpath/1-exploring-data-structures-for-make-newbies?share=copy
Copy and Paste this blueprint into a new Make Scenario
{
"subflows": [
{
"flow": [
{
"id": 3,
"module": "util:SetVariables",
"version": 1,
"parameters": {},
"mapper": {
"variables": [
{
"name": "Simple array",
"value": "{{add(emptyarray; \"apple\"; \"banana\"; \"cherry\"; 42; true; now; null)}}"
},
{
"name": "JSON simple collection",
"value": "{\n \"name\": \"Alex C\",\n \"age\": 2,\n \"city\": \"Houston\",\n \"date_entered\": \"{{now}}\"\n}"
},
{
"name": "JSON array of simple collections",
"value": "[\n {\n \"name\": \"Alex C\",\n \"age\": 53,\n \"city\": \"Toronto\"\n },\n {\n \"name\": \"Eric S\",\n \"age\": 43,\n \"city\": \"Hoboken\"\n }\n]"
},
{
"name": "JSON collection complex values",
"value": "{\n\t\"name\": \"Aleix Melon\",\n\t\"id\": \"E00245\",\n\t\"role\": [\"Dev\", \"DBA\"],\n\t\"age\": 23,\n\t\"doj\": \"11-12-2019\",\n\t\"married\": {{false}},\n\t\"address\": {\n\t\t\"street\": \"32, Laham St.\",\n\t\t\"city\": \"Innsbruck\",\n\t\t\"country\": \"Austria\"\n\t},\n\t\"referred-by\": \"E0012\"\n}"
},
{
"name": "JSON array of collections complex values",
"value": "[\n\t{\n \"name\": \"Aleix Melon\",\n \"id\": \"E00245\",\n \"role\": [\"Dev\", \"DBA\"],\n \"age\": 23,\n \"doj\": \"11-12-2019\",\n \"married\": {{false}},\n \"address\": {\n \"street\": \"32, Laham St.\",\n \"city\": \"Innsbruck\",\n \"country\": \"Austria\"\n },\n \"referred-by\": \"E0012\"\n\t},\n{\n \"name\": \"Bob Washington\",\n \"id\": \"E01245\",\n \"role\": [\"HR\"],\n \"age\": 43,\n \"doj\": \"10-06-2010\",\n \"married\": {{true}},\n \"address\": {\n \"street\": \"45, Abraham Lane.\",\n \"city\": \"Washington\",\n \"country\": \"USA\"\n },\n \"referred-by\": \"\"\n\t}\n]"
},
{
"name": "JSON array of collections of really complex values",
"value": "[\n {\n \"item_name\": \"Email campaign\",\n \"item_sku_attachment\": \"\",\n \"item_options\": [\n {\n \"Organization name\": \"Client A\"\n },\n {\n \"Writing services\": \"Writing service A\"\n },\n {\n \"Design services\": \"Design service B\"\n },\n {\n \"Comments\": \"test comment\"\n }\n ],\n \"item_image\": \"image.png\",\n \"unit_price\": 0,\n \"quantity\": 5,\n \"weight\": 0,\n \"created_at\": \"2024-05-11 13:37:46\",\n \"product_price\": 195,\n \"categories\": [\n {\n \"id\": \"cat_6633e1936571b618828100\",\n \"category_name\": \"Send\",\n \"category_slug\": \"send\",\n \"status\": \"1\"\n }\n ]\n },\n {\n \"item_name\": \"Ad campaign\",\n \"item_sku_attachment\": \"\",\n \"item_options\": [\n {\n \"Organization name\": \"Client B\"\n },\n {\n \"Writing services\": \"Writing service B\"\n },\n {\n \"Design services\": \"Design service C\"\n },\n {\n \"Comments\": \"test comment 2\"\n }\n ],\n \"item_image\": \"image.png\",\n \"unit_price\": 0,\n \"quantity\": 5,\n \"weight\": 0,\n \"created_at\": \"2023-05-11 13:37:46\",\n \"product_price\": 1295,\n \"categories\": [\n {\n \"id\": \"cat_6633e1936571b618828100\",\n \"category_name\": \"Send\",\n \"category_slug\": \"send\",\n \"status\": \"1\"\n }\n ]\n }\n]"
}
],
"scope": "roundtrip"
},
"metadata": {
"designer": {
"x": 0,
"y": 150
},
"restore": {
"expect": {
"variables": {
"items": [
null,
null,
null,
null,
null,
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": "Simple array",
"label": "Simple array",
"type": "any"
},
{
"name": "JSON simple collection",
"label": "JSON simple collection",
"type": "any"
},
{
"name": "JSON array of simple collections",
"label": "JSON array of simple collections",
"type": "any"
},
{
"name": "JSON collection complex values",
"label": "JSON collection complex values",
"type": "any"
},
{
"name": "JSON array of collections complex values",
"label": "JSON array of collections complex values",
"type": "any"
},
{
"name": "JSON array of collections of really complex values",
"label": "JSON array of collections of really complex values",
"type": "any"
}
]
}
},
{
"id": 5,
"module": "builtin:BasicFeeder",
"version": 1,
"parameters": {},
"mapper": {
"array": [
"{{3.`Simple array`}}",
"{{3.`JSON simple collection`}}",
"{{3.`JSON array of simple collections`}}",
"{{3.`JSON collection complex values`}}",
"{{3.`JSON array of collections complex values`}}",
"{{3.`JSON array of collections of really complex values`}}"
]
},
"metadata": {
"designer": {
"x": 300,
"y": 150
},
"restore": {
"expect": {
"array": {
"mode": "chose",
"items": [
null,
null,
null,
null,
null,
null
]
}
}
},
"expect": [
{
"name": "array",
"type": "array",
"label": "Array",
"mode": "edit",
"spec": []
}
]
}
},
{
"id": 6,
"module": "builtin:BasicRouter",
"version": 1,
"parameters": {
"else": 1
},
"mapper": null,
"metadata": {
"designer": {
"x": 600,
"y": 150
}
},
"routes": [
{
"flow": [
{
"id": 2,
"module": "builtin:BasicFeeder",
"version": 1,
"parameters": {},
"filter": {
"name": "First bundle",
"conditions": [
[
{
"a": "{{5.`__IMTINDEX__`}}",
"o": "number:equal",
"b": "1"
}
]
]
},
"mapper": {
"array": "{{5.value}}"
},
"metadata": {
"designer": {
"x": 900,
"y": 0,
"messages": [
{
"category": "last",
"severity": "warning",
"message": "A transformer should not be the last module in the route."
}
]
},
"restore": {
"expect": {
"array": {
"mode": "edit",
"items": [
null,
null,
null,
null
]
}
}
},
"expect": [
{
"name": "array",
"type": "array",
"label": "Array",
"mode": "edit",
"spec": []
}
]
}
}
]
},
{
"flow": [
{
"id": 7,
"module": "json:ParseJSON",
"version": 1,
"parameters": {
"type": ""
},
"mapper": {
"json": "{{5.value}}"
},
"metadata": {
"designer": {
"x": 900,
"y": 300,
"messages": [
{
"category": "last",
"severity": "warning",
"message": "A transformer should not be the last module in the route."
}
]
},
"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
}
]
}
}
]
}
]
}
]
}
],
"metadata": {
"version": 1
}
}
–
Alex Sirota
Director of NewPath Consulting - we are Make Heroes!
Check out my series of videos and scenario walkthroughs for Make Newbies