Bridge: Reference data from child workflow in the parent workflow

Options

Hi,

I am following Reference data from a child workflow article to get a very basic operation to work.

I have a child workflow which sets text using the String tool.

The parent workflow calls this child workflow (for no. of runs = 1 and no params passed).

The parent workflow references the value of "Compose Text" from the child workflow. It's reference within the child workflow is{{states.state_in_child.stringtools.compose_text}} . I try to reference this as per my understanding of the referenced article to reference the child's data, but it does not work.

The result is this:


The data reference (as per the linked article) should follow the format, states.{{state that runs the child}}.child.{{state in child}}.value.

I've tried the following references and none of them work:

a. {{states.calling_child.child.state_in_child.value}}

c. {{states.calling_child.child.state_in_child.stringtools.compose_text}}

d. {{states.calling_child.child.state_in_child.stringtools.compose_text.value}}

e. {{states.calling_child.child.state_in_child.stringtools.compose_text}}.value


Can anyone point out what I am missing?


Regards,

AK

Tags:

Best Answer

  • Genevieve P.
    Genevieve P. Employee Admin
    Answer ✓
    Options

    Hi @akhalid

    You had the reference correctly in the c instance!

     {{states.calling_child.child.state_in_child.stringtools.compose_text}}

    The reason the value is not coming through is because your Child Workflow utility has an array set. Even though the array is only 1, it's blocking the data reference as there could be multiple child workflows to reference.

    Try removing out the 1 in the calling_child "Number of Runs" field and leave it blank. This should only loop through the child workflow once, and allow your reference to get data from that workflow.

    Let me know if this works for you now.

    Cheers,

    Genevieve

Answers

  • Genevieve P.
    Genevieve P. Employee Admin
    Answer ✓
    Options

    Hi @akhalid

    You had the reference correctly in the c instance!

     {{states.calling_child.child.state_in_child.stringtools.compose_text}}

    The reason the value is not coming through is because your Child Workflow utility has an array set. Even though the array is only 1, it's blocking the data reference as there could be multiple child workflows to reference.

    Try removing out the 1 in the calling_child "Number of Runs" field and leave it blank. This should only loop through the child workflow once, and allow your reference to get data from that workflow.

    Let me know if this works for you now.

    Cheers,

    Genevieve

  • akhalid
    akhalid ✭✭✭
    Options

    Hi @Genevieve P. ,

    Removing no. of runs has certainly done the trick.

    If you recall Bridge: Passing parameters to child workflow, you had suggested to specify no. of runs as 1 (in your reply of 09/28) which is why I have always put that for a child workflow ever since.

    But, good to know that not specifying the no. of runs is still the right way.

    Regards,

    AK

  • Genevieve P.
    Genevieve P. Employee Admin
    Options

    Hey @akhalid

    Yes, I remember! In that scenario we do need the 1, but if you're looking to reference Child data back into a Parent, the generic reference structure doesn't know which one of the Child workflow runs to reference - for this request we'd clear it out. Are these workflows part of the same process?

    I did find another way to reference child data, but this is specifically if you have 2+ child runs. If you're going to have an array (2+) you can change the reference to decide which one to bring back into the Parent.

    {{states.<CHILD WORKFLOW STATE>.children.1.<STATE IN CHILD>.<MODULE>}}

    The number 1 is which child run to bring back. Does that make sense?

    Cheers,

    Genevieve

  • akhalid
    akhalid ✭✭✭
    Options

    @Genevieve P. ,

    Thank you for your response and the insight on array reference.

    My present workflow is a different one, and not related to the previous one.


    P.S. You have helped answer so many questions and unblock me in my quest for success that you have earned several coffees! Just don't know how to get them to you...but then you have to be a coffee lover as well. :-P

    Regards,

    AK

  • Genevieve P.
    Genevieve P. Employee Admin
    Options

    Haha, I am very much a coffee lover - I appreciate the virtual cup! Thank you 😊


  • akhalid
    akhalid ✭✭✭
    Options

    That would be the amount of coffee you have earned! :-)