Code Tool Behaviour

Continuing the discussion from Basic LLM Output Costumize:

I have problem that I need to solve asap. If you help me out it would be great.

I have 2 item as input I want to get datas from these items but no matter what I do I only got 1 item’s data here is my input whole data

In my referance video it looks like this

Any idea?

@NangAnhIUH

1 Like

Hi @Ozcorp ,

The main difference I can see between your code and the reference video is that you’re returning 1 item using {.}, and the code in the video is returning an array [.]. But keep in mind that the code in the video is also returning only 1 item.

You can use one of the other depending on what you want to do.

You are totally right that was test code.
If I return an array the results are the same but in the video I see inputs are the same Java Script code is the same but output is not.

Well, I can see you’re using the same code, yes. In that case, are you sure the format of the data from the previous node is exactly the same?

Could you show the JSON format of the input from the previous node in both the video and your own setup?

In the video the json format is not showed so I can not exactly sho you but when I compare it with table and Schema it looks totally same

In video: 28:18

My Output

Ok @Ozcorp,

I think that the last thing I can contribute here is that in the left section, you should have something similar to this in JSON format. Please check how you can get that from the previous node, so you have the output you wish in the right section.

[
  {
    "json": {
      "response": {
        "text": "Unrolling a richly embroidered silk tapestry"
      },
      "data": {
        "output": {
          "video_url": "https://storage.theapi.app/videos/272611789526770.mp4"
        }
      },
      "webContentLink": "https://drive.google.com/uc?id=1WbD0O1Za8JabPtLrpIPA-wqcuWMbHX0Od&export=download",
      "status": "completed"
    }
  },
  {
    "json": {
      "response": {
        "text": "Gesturing toward servants to prepare a lavish feast"
      },
      "data": {
        "output": {
          "video_url": "https://storage.theapi.app/videos/272611790522112.mp4"
        }
      },
      "webContentLink": "https://drive.google.com/uc?id=1O0y2vLDY_8cWz3SVsl8UYVUYJq-3J70&export=download",
      "status": "completed"
    }
  }
]