Use case

You have two tables containing information about employees on different pages.

The first table is an Excel spreadsheet with data.

You need to fill in the blanks or update values in the second table with data from the first one by matching the 'Employee' columns.

Solution

  1. Switch the page to the edit mode.
  2. Insert the Table Transformer macro and paste the tables or the macros outputting tables within the macro body.
  3. Select the macro and click Edit.
  4. In the Presets tab select Custom transformation and click Next.
  5. Enter the following SQL query: 

    SELECT T1.'Number', T1.'Employee', T1.'Position',
     CASE
      WHEN T2.'City' IS NULL 
      THEN T1.'Location'
      ELSE T2.'City'
     END
     AS 'Location'
    FROM T1 LEFT JOIN T2 ON T1.'Employee'->toLowerCase() = T2.'Employee'→toLowerCase()
    SQL
  6. Click Next

  7. Define the table settings and view options if needed

  8. Save the macro and the page. 

You can use FORMATWIKI function for the purposes of cell formatting.


Advanced Use Case

You need to select values manually (without column matching) and add them into empty cells only.

Solution

Enter the following SQL query:

SELECT T1.'Number',T1.'Employee',T1.'Position',
 CASE
  WHEN T1.'Employee' = "John Anderson" AND T1.'Location' IS NULL
  THEN (SELECT T2.'City' FROM T2 WHERE T2.'Employee' = "John Anderson")
  WHEN T1.'Employee' = "Alban Jacobs" AND T1.'Location' IS NULL  
  THEN (SELECT T2.'City' FROM T2 WHERE T2.'Employee' = "Alban Jacobs")
  ELSE T1.'Location' 
 END
 AS 'Location'
FROM T1
SQL