BLOCKS Reference

Block Reference

Common features

% format character strings

Some BLOCKS’ properties can be configured with dynamic values specified by a % sign, such as “%Y/%m/%d %H:%M:%S”. These % format characters are converted into Datetimes when the BLOCK is processed.

The converted Datetimes differ depending on whether the Flow was executed manually or using regularly scheduled execution.

  • Regularly scheduled execution: the value designated in the “Start time” property of the Start of Flow BLOCK.
  • Manual execution: the Datetime when MAGELLAN BLOCKS received the manual execution request.

For example, assume the following has been entered into the Slack notice BLOCK’s "Notification message" property:

Time of processing: %Y/%m/%d %H:%M:%S

Also, assume that the Flow containing this BLOCK has "0 * * * *" entered into its “Start time” property to execute at the start of each hour.

In this case, if the Flow executes at exactly 2016/4/13 11:01:23, the % format character string will be converted into the following when the Slack notice BLOCK processes:

Time of processing: 2016/04/13 11:00:00

As you can see, the converted Datetime is not the actual time that the Flow executed. Please be aware of this when using regularly scheduled Flow execution.

The 11:01:23 execution time is when the Flow scheduled to run at 11:00:00 actually executed.

% format list

You can use the following % format characters:

Format Explanation
%% Displays a "%". For example, "%%c" displays as "%c" and does not convert to Datetime.
%a Displays an abbreviation for the day of the week. Ex. Wed
%A Displays the complete name of the day of the week. Ex. Wednesday
%b Displays an abbreviation for the month. Ex. Apr
%B Displays the complete name of the month. Ex. April
%c Displays the date and time. Ex. Wed Apr 13 11:03:47
%C Displays the century (first two digits on the Western calendar). Ex. 20
%d Displays the total number of days passed in the month (01-31) with a "0" in the tens place for single-digit numbers. Ex. 09
%D Displays the date in month/day/year format (same as entering %m/%d/%y). Ex. 04/13/16
%e Displays the total number of days passed in the month (1-31). Unlike %d, a 0 does not display in the tens place for single digit numbers. Ex. 13
%F Displays the date in year-month-day format (same as entering %Y-%m-%d). Ex. 2016-04-13
%g Displays the last two digits (00-99) of the ISO 8601 week unit/year display format. These two digits represent the year. In theory, the information displayed is that same as that for %y, however if the ISO week number falls in the prior or following calendar year, that year will be used. Ex. 16
%G This is the same as %g but a 4-digit Western calendar time is displayed. Furthermore, it is the same as %Y, however if the ISO week number falls in the prior or following calendar year, that year will be used. Ex. 2016
%h Displays the same content as %b. Ex. Apr
%H Displays hours in military time (0-23) with a “0” in the tens place of single digit numbers. Ex.09
%I Displays hours using AM/PM (0-12) with a “0” in the tens place for single digit numbers. Ex. 09
%j Displays the number of days passed in the current year (001-366). Ex. 104
%k Displays hours in military time (0-23). Ex. 9
%l Displays hours using AM/PM (0-12). Ex. 9
%m Displays the month (1-12) with a “0” in the tens place of single digit numbers. Ex. 04
%M Displays minutes (0-59) with a “0” in the tens place of single digit numbers. Ex. 03
%n Signifies a carriage return
%p Displays morning and afternoon as "AM" and "PM". Noon is recognized as PM, and midnight as AM. Ex. AM
%r Displays time of day in AM/PM format. Ex. 11:03:47 AM
%R Displays time of day in military time format. Note, seconds are not displayed. Ex. 11:03
%s Displays the time (Coordinated Universal Time (UTC)) in seconds from 1970, January, 1, 0 AM, 0 min., 0 sec. Ex. 1460513027
%S Displays seconds (0-60) with a "0" in the tens place of single digit numbers. Ex. 47
%t Signifies the tab mark.
%T Displays military time. Ex. 11:03:47
%u Displays the day of the week as a number (1-7). Monday=1, Tuesday=2, Wednesday=3, Thursday=4, Friday=5, Saturday=6, and Sunday=7.
%U Displays the week of the year as a number (1-53) with the first week starting from the first Sunday of the year. Ex. 15
%V Displays weeks (01-53) in ISO 8601 format. The first week with 4 or more days in it is recognized as the first week of the year. Ex. 15
%w Displays the day of the week as a number (0-6). Sunday=0, Monday=1, Tuesday=2, Wednesday=3, Thursday=4, Friday=5, and Saturday=6.
%W Displays the week of the year as a number (00-53) with the first week starting from the first Monday of the year. Ex. 15
%x Displays the date. Ex. 04/13/16
%X Displays the time. Ex. 11:03:47
%y Displays the last two digits of the year on the Western calendar. Ex. 16
%Y Displays the year on the Western calendar. Ex. 2016
%z Displays the time zone in +hhmm/-hhmm format. Ex. +0900
%Z Displays the abbreviated time zone name. Ex. JST

Permissible properties

Properties supporting input of % format characters are listed in the table below.

Category BLOCK Property
Basic Slack notice Slack display name
Channel
Icon
Notification message
API HTTP GET The value field of Query parameters
HTTP POST The value field of Query parameters
HTTP PUT The value field of Query parameters
HTTP DELETE The value field of query parameters
BigQuery Load to single table from GCS Destination dataset
Destination table
Load to table from variable Destination dataset
Destination table
Load to multiple tables from GCS Source data file group URL in GCS
Destination dataset
Destination table
File count check URL
Export single table to GCS Export destination file URL in GCS
Source dataset to export
Source table to export

Export multiple tables to GCS

Exported file group URL in GCS
Export destination file extension
Source dataset to export
Source table to export
Execute query Query
Result storage dataset
Result storage table

Execute parallel queries

Query
Result storage dataset
Result storage table
Split table by column values Source dataset for split
Source table for split
Split table dataset
Table produced from table split
Create view Result storage dataset
Result storage table
Stream insert Destination dataset
Destination table
Delete table Target dataset
Target table
Machine Learning Vision API (general purpose) GCS image URL
Beta Launch VM instance from GCE Zone
VM instance
Suspend VM instance from GCE Zone
VM instance
Cloud Speech API Audio file URL

Variable expansion

Depending on the properties of BLOCKS, it is possible to express expanded variables.

Format

${variable}
When you script a variable between "${" and "}", the content referenced by that variable takes the place of the variable when the BLOCK performs processing.

Variable_ (underscore)

${_}
"_" (underscore) exists as a special variable. A "variable_" will reference the output result of the preceding BLOCK.

Permissible characters for variable names

You may use uppercase and lowercase letters of the roman alphabet, numbers, and _ (underscore). However, you may not use numbers alone to name a variable.

Reserved terms

Variables defined by MAGELLAN BLOCKS use names beginning with _ (underscore). Currently, the following variable names are defined (Additions coming in the future).

  • _flow_aliases
  • _flow_id
  • _flow_name

Permissible properties

The places you may script expanded variables are the same places where % format character string properties can be used.

Partial reference for hash and array format data

When data is in hash or array format, some of that data can be referenced by variables.

Format

<Hash format>
Variable.Key or .Key
<Array format>
Variable.index or .index

For example, the variable x references the following hash format data.

Key Value
name "BLOCKS"
email "blocks@example.jp"

In this instance, ${x.name} references "BLOCKS".

And, the variable y references the following array format data.

Index 0 1 2
Value "Basic" "API" "BigQuery"

In this case, ${y.1} references "API".

In the case of nested data, you can connect items with a period (.), like this, "variable.key.key" and "variable.key.index", etc., and you are able to reference the nested data.

For example, in the following example, variable z is referencing nested data.

Key Value
name
Index 0 1
Value "MAGELLAN" "BLOCKS"
email "blocks@example.jp"

In this case, ${z.name.0} is referencing "MAGELLAN".

When abbreviating variables, variable_ (underscore) is assumed to be in use and processed accordingly.