Display result of API in textinput

Hi,

I have created a data flow with an API request and then transform the result to get only 1 particular value. When I test it I get the output in Transform as array - [value]
I have set the session variable to bind the output of the dataflow.
How do I access the value of the transform output array?

Thanks in advance.

hi @Rheal! you can index into that array by doing something like

variable_name[0]

to get the first value of the array. For more info, take a look at our Airscript Quickstart

Or is this question more about how to define the output of a Data Flow?

The output of individual Data Operations is local variables that are auto-created with he Data Operation and managed in the Inspector. This is where you can find what these local variables are called (and rename them to something more intuitive, if you so choose).

To define a Data Flow so that it returns the value stored in a particular local variable, select the desired variable from the dropdown menu in the End box at the bottom of the Stage, under Return Value. For a deeper dive into this, you can check out the Connections Builder doc.

To actually run this Data Flow and access the returned value within a Journey, you need to use the Run Data Flow Action. This comes with the option to bind the output to a session variable (or any other Journey-level variable, see Variable Namespaces for more details) by entering the variable you want to bind the output to under Output Binding.

And once you’ve fired your Run Data Flow Action, you’ll have this value saved to your session variable, and you’ll be able to call on it throughout the rest of your Journey!

@Rheal, does that answer your question?

Hi Ismaen,

I tried that already and it shows blank.

Regards

Hi Changra_Bergmann,

No, this is question is not about how to define the output of a Data Flow.
In the return value, I bind the value to the Transform variable and can see the result like an array - [23569]. But when I bind it to a textbox I am unable to display it using the format variable_name[0].

That is part where I am stuck. If I get a full array with key-value pairs, I can display it.

Regards

So if i understand the question correctly, you actually want to bind it to the value of a text input, not a label. That was my misunderstanding! So in order to do that, you have to:

  1. Parse the data out of the array
  2. Format integer into a string
  3. Store that string to a variable
  4. pass that variable to the text input value

So if your data flow returns the array [23569] you can simply add an additional transform step after the output of that array to parse that data and format into a string.

FORMAT_NUMBER(array[0])

Then you would pass this transform step as the output of the data flow

Then when you run the data flow, you would essentially have the output binding to the value of your text input box. In my case the variable is named text_input.

From there, the result from the data flow, should populate into the text input box.

Here’s a attached zip of my app that shows how this works.
Pass_data_into_text_input-2022-11-29T05_11_37.115Z-full.branch.zip (17.8 KB)