Session 7 / 15๐Ÿ”Žืขื‘

In one sentence

Students process data like analysts โ€” array functions, regex, CSV/HTML and Make Code โ€” and build a weekly report.

Preparation before the session

Time plan

  1. 00:00โ€“00:15 Review: the payment reminders
  2. 00:15โ€“00:50 Advanced array functions
  3. 00:50โ€“01:15 The Text parser and regex
  4. 01:15โ€“01:30 โ˜• Break
  5. 01:30โ€“01:50 CSV, HTML and files
  6. 01:50โ€“02:15 Make Code: JavaScript and Python
  7. 02:15โ€“02:50 Building together: a weekly sales report
  8. 02:50โ€“03:00 Summary and practice

Lecture parts and activity type

PartActivity type
Array functions โ€” power without modulesPlayground
The Text parser โ€” extracting from textDemo
CSV, HTML and filesDemo
Make Code โ€” when functions aren't enoughDemo
Weekly KPIs โ€” what to measureExplanation
Building together: a weekly sales reportBuilding together

The 3 messages that must get across

  1. One function > three modules.
  2. Regex for a fixed format.
  3. Make Code when you really need it.

Questions for class discussion

  • Which report in your organization is still done manually?
  • Who needs to receive it and through which channel?
  • When is an automatic report dangerous (wrong numbers without anyone checking)?

Live demo script

Array functions

  1. Search โ€” Search Rows without a filter (or by date).
  2. Aggregator โ€” Array aggregator, Source: Search Rows, fields: agent, amount, region.
  3. KPIs โ€” total={{sum(map(2.array; "amount"))}}, deals={{length(2.array)}}, avg={{round(total/deals)}}, agents={{join(distinct(map(2.array; "agent")); ", ")}}.
  4. Filtered โ€” sumCenter={{sum(map(2.array; "amount"; "region"; "Center"))}}.

The Text parser on order emails

  1. Input โ€” Tools โ†’ Compose a string with the order text.
  2. Regex โ€” Text parser โ†’ Match pattern โ†’ the pattern from the lecture โ†’ Run once.
  3. Conversions โ€” amount={{parseNumber(replace(2.amount; ","; emptystring))}}, date={{parseDate(2.date; "DD/MM/YYYY")}}.
  4. Filter โ€” order Exists.

An HTML table and a CSV

  1. Table โ€” Text aggregator (Source: Search Rows), Text: <tr><td>{{agent}}</td>โ€ฆ</tr>.
  2. CSV โ€” CSV โ†’ Create CSV (advanced) โ†’ Source: Search Rows? (or Array aggregator) โ†’ fields.
  3. BOM โ€” File data: {{"\uFEFF" + 6.text}} (or the Include BOM option if it exists).
  4. Gmail โ€” HTML content with <table>, Attachments: file name sales-week-{{formatDate(now; "W")}}.csv, Data: the CSV.

Problems students will run into

ProblemQuick fix
sum returns an errorText values with a currency sign or commas โ€” clean them in the sheet or parseNumber.
agents appears as [object]map on a whole collection โ€” specify a field.
The pattern doesn't matchTypographic quotes/dots vs. plain ones โ€” use .? instead.
amount with a commareplace before parseNumber.
Gmail was sent 30 timesThe Text aggregator/CSV isn't set with the right source.
The CSV is gibberish in ExcelThe BOM is missing.
prev = 0 โ†’ division by zeroif(prev = 0; "โ€”"; โ€ฆ).
Make Code: input undefinedMap the array to an input field named rows.

Tips from the classroom

  • map with filtering is a "wow" moment โ€” spend time on it.
  • Not everyone has a paid plan โ€” show Make Code as a demo.
  • Remind them about the midterm exam.

Adapting to different levels

For students who struggle: KPIs with functions only.

For fast students: Top 3 + a yearly comparison.

Answer key โ€” multiple-choice questions

Students see the answers in shuffled order, so the key gives the wording of the right answer.

per row
#Right answer
1slice(sort(array; "desc"; "amount"); 0; 3)
2A list of agents without duplicates
3A fixed, known format
4(?\d+)
5About 2 Credits a second
6Outputs a bundle per group
7A Text aggregator with
8sum()

Homework

  1. An active weekly report.
  2. Preparing for session 8: open free accounts on Airtable and Supabase.
  3. ๐ŸŽ“ The midterm exam (sessions 1โ€“7) is available on the home page.