Flux query for grafana table panel to show missing values (left join equivalent?)

I’m a bit lost as how to achieve this in a flux query…

I have procstat data coming from telegraf via influxdb2
This gives me a list of running processes.
Here’s what the current flux query looks like:

from(bucket: "bucket_a")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop) // Use dynamic time range values
|> filter(fn: (r) => r.host =~ /^${Hosts:regex}$/) // allow users to filter hosts dynamically
|> filter(fn: (r) => r["_field"] == "pid")
|> last() // Get the most recent value for each group
|> rename(columns: {_value: "pid"}) // Rename _value to pid
|> group() // Merge all groups into a single table

in the data set each process name is in the “process_name” column.

I want to create a panel that shows the state of the following processes:
process_a
process_b
process_c
process_d

How do I write a flux query that matches these processes with the list in process_name and shows 1 where found and 0 where missing so I can put some threshold colours on it?

Nevermind. I worked it out.
Here’s what I did:

import "array"
import "join"

// define a list of processes to show in the table
processesToMonitor = array.from(
  rows: [
  {process_name: "ProcessNameA"},
  {process_name: "ProcessNameB"},
  {process_name: "ProcessNameC"}
  ]
)

// Fetch procstat data for current processes
processData = ( 
  from(bucket: "BucketA")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop) // Use dynamic time range values
  |> filter(fn: (r) => r.host =~ /^${Hosts:regex}$/)
  |> filter(fn: (r) => r["_field"] == "pid")
  |> last() // Get the most recent value for each group
  |> rename(columns: {_value: "pid"}) // Rename _value to pid
  |> group() // Merge all groups into a single table
)


// match the procstat data with the defined list
// see:  https://docs.influxdata.com/flux/v0/join-data/left-outer/
join.left (
  left: processesToMonitor,
  right: processData,
  on: (l, r) => l.process_name == r.process_name,
  as: (l, r) => (
    {
      host: r.host, 
      process_name: l.process_name, 
      pid: r.pid, 
      found: exists r.host
    }
  ),
)