watsonx Orchestrate

watsonx Orchestrate

Connect with experts and peers to elevate technical expertise, solve problems and share insights.

Β View Only
Expand all | Collapse all

How can I join two lists by index in Watson Orchestrate without using an external server?

  • 1.  How can I join two lists by index in Watson Orchestrate without using an external server?

    Posted Tue March 25, 2025 02:16 PM

    Hi everyone,

    I'm building a workflow in Watsonx Orchestrate and hit a wall with something that feels like it should be simple - joining two lists together - but apparently requires a workaround involving an external API.


    πŸ”§ What my workflow does

    The flow performs the following steps:

    1. Lists files from a specific Google Drive folder.
    2. Reads the content of each file.
    3. Passes the content to a Generative AI step to create customized text.
    4. Creates new files in Google Drive.
    5. Then I need to update those new files with the AI-generated content.

    🎯 The challenge

    At the end of the flow, I have two lists:

    • fileIds: a list of newly created file IDs.
    • contents: a list of strings generated by the AI.

    What I need is a single combined list like this:

    json
    [ { "fileId": "abc123", "content": "Generated text 1" }, { "fileId": "def456", "content": "Generated text 2" } ]

    So I can run a foreach loop over that and update each file with its corresponding content.


    πŸ’‘ Current workaround

    Right now, I'm using an external FastAPI microservice (hosted on Heroku) that:

    • Accepts the two lists (fileIds and contents)
    • Zips them together by index
    • Returns the merged list of { fileId, content } objects

    I exposed this as an OpenAPI skill with an API key for security. It works perfectly - but it feels like overkill just for merging two aligned lists.


    ❓ My question

    Is there a native way in Watson Orchestrate to zip or join two lists by index into a single list of objects, without calling an external API?

    Even a workaround using expressions, foreach, or variable tricks would be great. I just want to avoid depending on an external service for something this basic.


    βœ… End goal

    Combine two parallel lists into one list of objects { fileId, content }, entirely within Orchestrate.

    Any ideas, hacks, or examples would be massively appreciated. Thanks in advance!



    ------------------------------
    cristian rojas
    ------------------------------


  • 2.  RE: How can I join two lists by index in Watson Orchestrate without using an external server?

    Posted Thu March 27, 2025 09:58 AM

    Hello Cristian,

    A few questions to clarify your use case and to understand what features may be available to accomplish your goal without an external API, since Skill Flows, Projects/Workflows, and AI Assistant Actions have some different capabilities.

    1. Is this specifically a "Workflow" (Project), or a Skill Flow?
    2. Are you using an AI Assistant? How do people initiate your flow?

    Thank you,

    Enrico



    ------------------------------
    Enrico Monteleone
    IBM Support
    ------------------------------



  • 3.  RE: How can I join two lists by index in Watson Orchestrate without using an external server?

    Posted Thu March 27, 2025 04:12 PM

    Hi Enrico,

    Thanks for the quick response.

    To clarify, this is a Workflow (Project) in Watson Orchestrate, not a Skill Flow. The flow is triggered from the Workflow interface, not from an AI Assistant.

    Let me explain the exact use case and where the issue arises.


    πŸ” What the flow looks like

    (See the attached image)

    The workflow performs the following steps:

    1. Lists files from a Google Drive folder.
    2. Reads each file's content.
    3. Sends the content to a Generative AI task that produces a list of custom texts (one per file).
    4. Creates a new file in Google Drive for each AI response.
    5. Needs to update each of those files with its respective AI-generated content.

    πŸ”„ The Problem

    At the end of the process, we have:

    • A list of new file IDs (returned from the "Create file" step).
    • A list of generated text contents (returned from the Generative AI step).

    These are two separate, aligned lists:

    • Example:
      • fileIds = ["abc123", "def456"]
      • contents = ["Generated text 1", "Generated text 2"]

    βœ… What we need

    We simply want to combine these into a single list of objects like:

    json
    [ { "fileId": "abc123", "content": "Generated text 1" }, { "fileId": "def456", "content": "Generated text 2" } ]

    This would allow us to loop through each item and update the file with the correct content in one final step.


    🧩 Where we're stuck

    There doesn't seem to be a built-in way in Watson Orchestrate to join two lists by index. The platform lets us iterate through one list using a Foreach block, but we haven't found a way to merge two lists together natively without an external service.


    Let me know if there's a native feature, hack, or workaround inside the Workflow builder to achieve this. Happy to provide more details or test any suggestion.

    Thanks again,
    Cristian Rojas



    ------------------------------
    cristian rojas
    ------------------------------



  • 4.  RE: How can I join two lists by index in Watson Orchestrate without using an external server?

    Posted Mon March 31, 2025 08:56 PM
    Hi Cristian,

    See my notes below and attached images. Hope this helps.

    It looks like this currently is not possible in workflows.
    Creating workflows - IBM Documentation

    You can vote for this idea or propose another idea on the Ideas site.
    Ability to parse Gen AI output into a structured object - IBM Ideas

    However, I can combine JSON objects in an AI Assistant Action.
    Expression language methods for actions - IBM Documentation


    ------------------------------
    Thank you,
    Enrico Monteleone
    IBM Support
    ------------------------------