GetMyBot 知识库

Data from previous steps

Select a search result, row field or loop item, preserve list completeness and identify values that are not available yet.

本页内容

Search finds classes, a calculation prepares prices, and the next message needs a title. You do not have to remember every variable name: the editor shows data available before the current action.

Each result identifies its producer action, saved key and known type. For example: Class search → search → first row → title.

Lesson 1. Insert a found title into a message

Prepare the collection and search using the catalog lesson. Its name field contains the class title.

  1. Add Search collection and save its result as search.
  2. Add a message below it and click Insert data by the text field.
  3. Enter search.first.name in Find a field or result and select the sample collection's name field.
  4. The editor inserts {{ctx.search.first.name}}.

For example, Found: {{ctx.search.first.name}} displays “Found: Watercolor” when that is the first matching title. Selecting a field does not guarantee a match exists. Handle empty results first, or show this message only on the appropriate branch.

You set the search key in Save result as. It is temporary data for the current execution, not a persistent user parameter. Use parameters or collections to retain data between runs.

For a list source, use Choose data beside that field. The picker initially shows compatible types; Show other types reveals the other choices. Each entry identifies its producer step and the exact key that will be saved. Entries that only describe an object's structure without a separately available key cannot be inserted as substitutions.

The picker uses current unsaved settings. You can fill a new action's blank source before saving it: suggestions describe data available before that step. They do not validate the entire unfinished draft. If an earlier step contains invalid JSON, correct it first; the last successfully parsed value is not substituted for the invalid text you currently see.

Check data connections throughout the draft

Click Check draft data in the editor to inspect source, type and availability problems. This check does not execute the flow. Use the separate draft check to evaluate the complete chain with a sample event.

Apply changes in any open button or nested-item editor first. Reordering actions, changing the channel or updating a block definition makes the previous result stale. Use Correct the value to reach unfinished JSON or number input; the entered text is retained.

Analysis is limited to 256 actions, 64 related definitions and nesting depth 16. The request must fit within 1 MiB. If the editor reports a limit, the previous result does not validate the current draft. Known keys can still be entered manually. Execution limits are described in the action budget.

List source versus text template

These fields use different values:

  • Source for a list-processing action: select the entire search result. The field stores search.
  • Message text: select the first row's title. This inserts {{ctx.search.first.name}} into the text.
  • List for a loop: select the search rows. The field stores search.rows.

A list source needs neither ctx. nor braces. Text needs a template. The helper accounts for the destination field; retain this distinction when typing manually.

Why pass the entire result

Search results contain rows plus completeness and match information. Pass search to Map list fields, Join lists, Transform a list or Groups and totals to preserve the relevant metadata.

Passing only search.rows supplies an ordinary array. Its rows can be processed, but information about an incomplete result is lost. Totals over those rows must not be described as whole-collection totals.

This is especially important for catalog pages. Even the final page with has_more=false does not contain previous pages. Pages and collection totals.

Lesson 2. Use the current item's field

Loops and dynamic button templates expose the current row. With list search.rows and the default alias item, use {{item.name}} for its title.

  • Use {{item.name}} as a button label.
  • Select the same row's ID for button data, for example {{item._record_id}} for a genuine collection record.
  • Within a loop, select the current item's fields rather than the first row of the whole result.

Outside a loop or button template, item does not identify a current row. Do not copy it into an ordinary message after the loop. Dynamic buttons.

For external-service rows, id remains that service's ordinary identifier. Selecting it does not turn it into the collection's internal _record_id. Updating a collection record requires its own record ID.

Type and availability hints

HintMeaning
Text, number, object, array or resultType known from action settings or collection schema
ConditionalValue appears only on some execution paths
Inferred from sampleType or fields come from a sample you supplied
UnknownSettings do not reliably describe the data

An unknown type is not always an error. HTTP can return arbitrary JSON. Configure extraction of the required value in the HTTP action's result, or enter a known key manually and check the flow with a sample response. A hint inferred from a sample describes that sample; it does not guarantee that the live service always returns the same data.

An empty sample list does not mean a loop will never run. A live response can contain rows, so its loop actions still need checking. Likewise, one sample row does not guarantee that the service always returns at least one.

An available result can still contain an empty field. For example, an aggregate has completed, but its average, minimum or maximum is null when no numeric inputs matched. Handle that empty case before passing the field to a required numeric block input. A sum with no numeric inputs is 0.

That field remains null in the full result JSON. A separate substitution such as {{ctx.total.first.average}} is absent in this case: check that a value exists before using it as a number.

An action below the current step has not run yet. Its output is not available now. After reordering actions, renaming a result or changing block outputs, inspect diagnostics and update data references. The helper does not replace empty-result or outcome checks.

If a field is missing

Manual input remains available for dynamic cases. Use it when you know the actual data format, then verify it in draft testing.

Collection fields come from its schema. These hints require collection read access; limited permissions can leave the result shape unknown. Check access if the correct collection is selected but its fields are missing. Permission to analyze a flow is checked separately from permission to save changes.

In a standalone block editor, the picker shows declared inputs, such as the source input.orders. Other keys inside the block body can be entered manually. In a reaction, a block-call argument is selected from data available before that call. An arbitrary object output does not gain an automatic first shortcut: use a genuinely available path such as calculation.result.rows.0.amount and handle an empty list first.

For a nested HTTP response, first extract the required list or add Map fields. For example, extract nested customer.name into an ordinary guest_name field. A literal field named customer.name differs from a customer object containing name; their paths differ too. Paths and field extraction.

For an unavailable-source diagnostic, check that the producer comes first, its saved key matches and the execution path reaches it. Do not substitute an arbitrary empty list just to remove the error: that hides the cause and can produce an incorrect total.

Related: data processing, typed block outputs, action outcomes.