Search HoldMyTwist

Browse all posts

Check blank and over-limit text in Make before routing

Before you try and hook anything live, check the blank text and 500 utf16 unit boundary in Make Free.

Fictional text cards split into a teal human-review tray and an amber input-check tray.

Use fictional strings for checking Make Free count and blank_count. The original length of a string of spaces is positive, even though it's blank.

Sign in to Make, or Signup for a Free account (link above). Disable scheduling and only use fake values. Don't connect to a real destination.

Practice only

Before you put actual text there make sure you check the selected route and original_text in the last module. Unplug the live destinations. Observations saved are at the last part.

Illustration: nonblank text of 500 UTF-16 units or fewer goes to human review; blank or longer text goes to check input.

Illustration: nonblank text of 500 UTF-16 units or fewer goes to human review; blank or longer text goes to check input.
Open full-size image

The picture is for illustration for both routing choices. It's not a screenshot from Make. The exercise is about UTF-16 units. And in the last one, we're using 😀 (two UTF-16 units).

1. Add fictional input

First, start with a brand new Make scenario. Don't turn on scheduling. Add a JSON > Parse JSON module. In the JSON string, you will use the entire fictional array below.

Text to copy

[  {"id":"text","original_text":"Please check this draft."},  {"id":"empty","original_text":""},  {"id":"spaces","original_text":"   "}]

Set the text type for the id and original_text in Parse JSON. The parser will return a bundle for each item in the top level array by default. Make each record have a unique text id. Follow the Make JSON documentation (opens in a new tab) for exposing fields to map. You see string values in original_text of the input examples. That does not validate for missing/non-string original_text values.

2. Measure the text

Add Tools > Set multiple variables with count and blank_count as variable names. Put the parser's original_text in the following expressions:

Text to copy

count = length(1.original_text)blank_count = length(trim(1.original_text))

In this example my parser is 1. If your parser token is different, choose that one. See Make's text function reference (opens in a new tab) for documentation of these two functions. The original_text field is never trimmed. count is the length of that original text. blank_count is the length of the trimmed version. For the 3 starter records, the count/blank_count pairs are: text 24/24, empty 0/0, spaces 3/0. If any pair is different, take a moment to review your mappings.

3. Set two route filters

Add a router after the calculate module. At the end of each route, use Tools > Set multiple variables. For the numeric filters, use the 2 counts that have been mapped:

Text to copy

Human-review candidate: blank_count > 0 AND count <= 500Check input: blank_count = 0 OR count > 500

Read Make’s Router docs (opens in a new tab).

All routes check the filter. One record can go to multiple routes (if it passes the filter).

The filters for these strings are exclusive.

Map id and original_text from Parse JSON + count + blank_count from calc in each final Tools module.

Text to copy

Candidate endpointterminal = candidate_for_human_reviewreason = gate_only

Check-input endpointterminal = manual_review

On the check input route;

open the last Tools > Set multiple variables module

Set the reason field to the following suggested expression

Use your own calculation module's blank_count instead of copying the example token 2.blank_count.

Run scenario to check reason output and use as required.

Text to copy

if(2.blank_count = 0; blank; over_limit)

4. Check the output before using real text

Replace the entire json string within Parse JSON module with the following fictional array. Run the same isolated scenario only once. There should be 7 total outputs in the end (1 output per unique id). Verify that each output has the following count/blank_count/terminal/reason/original_text values and type match the expected. Note that the new reproduced array is different than historical recorded result.

new reproduction array (different than historical recorded result)

Text to copy

[  {    "id": "audit89-499-a",    "original_text": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"  },  {    "id": "audit89-500-a",    "original_text": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"  },  {    "id": "audit89-501-a",    "original_text": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"  },  {    "id": "audit89-empty",    "original_text": ""  },  {    "id": "audit89-500-spaces",    "original_text": "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    "  },  {    "id": "audit89-mixed-whitespace",    "original_text": " \t\r\n\u000b\f"  },  {    "id": "audit89-499-a-emoji",    "original_text": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA😀"  }]

Text to copy

Input | Expected terminal | Expected reason499 uppercase A characters | candidate_for_human_review | gate_only500 uppercase A characters | candidate_for_human_review | gate_only501 uppercase A characters | manual_review | over_limitEmpty string "" | manual_review | blank500 spaces | manual_review | blank" \t\r\n\u000b\f" | manual_review | blank499 uppercase A characters immediately followed by 😀 | manual_review | over_limit; count 501

In the last module check against original input text value and type. Make sure empty string is still empty. Make sure all 500 spaces still there. In last test string emoji is right after last A.

Text to copy

Recorded practice | Seven-case runMatched routes | 7 / 7Empty-string record, Parse JSON output | "" (string)Empty-string record, final module input | nullEmpty-string record, final module output | nullOther strings preserved | 6 / 6Proposed change | Explicit empty-string mappingSecond native run verifying proposed change | Not performed

When a mapping is changed all the 7 records in the current isolated scenario should be re-run. All final values/types should be compared against the original input values. Before attaching a destination check the length/white space rules for that destination. All human-review candidates must be inspected by a person.

Share this post