How can data be passed to two nodes from a script node?


image

Here, you can see that the setPagination script is logged in the console, but the flow is getting stuck somewhere. It did not reached to response script

@Simphiwe @Sam, Please help!

Hello @Vivek , for calling 2 nodes at a same time I think you can use async node before the 2 nodes

1 Like

Hi @Vivek,

It also might not be even reaching that response script. Try checking if your data models(total count and find with limit and skip) on your flow runs successfully one by one.
Maybe remove the connector to the response script and add a log node to log bh.local.books or bh.local.totalCount

1 Like
  1. Its stuck in setPagination script node
  2. even I connected setPagiation to logger, not logged anythig(bh.local.findOptions)
  3. setPagination - total count node - logger(bh.local.totalCount) - no result
  4. setPagination - limit and skip node - logger(bh.local.books) - no result

for the below setPagination script code console give:
image

console.log("query", bh.input.query);

let page = parseInt(bh.input.query.page) || 1;
let limit = parseInt(bh.input.query.limit) || 5;
let skip = (page - 1) * limit;

bh.local.query = {};
bh.local.limit = limit;
bh.local.skip = skip;
bh.local.findOptions = { limit: limit, skip: skip };

console.log("88888", { page, limit, skip, findOptions: bh.local.findOptions });
return bh;```

@Vivek ,

It doesn’t run the following nodes because of the return at the end of the setPagination script.
Can you please try removing return bh, everything assigned on your bh will be accessible by other nodes on you flow.

2 Likes