Combine multiple (nested) Create

Hi,
I have the datamodel shown in the screenshot. I would like to Create Links and use the output result (= Link IDs) as input for Create Topics. Is it possible to combine these two actions in FQL? This is what I have at this moment:

q.Create(q.Collection("topics"), {
	data: {
	  name: name,
	  description: description,
	  link: [],
	},
})

Many thanks in advance for your help.

Hi @tuan,

something like that might work for your case?

Let(
  {
    ref1: Select(['ref'],Create(Collection("links"),{data:{link:1}})),
    ref2: Select(['ref'],Create(Collection("links"),{data:{link:2}}))
  },
  Create(Collection("topics"), {data: {name: "topic1",description: "topic 1 desc",link: [Var('ref1'),Var('ref2')]}})
)

Luigi

1 Like

It works like a charm. Thank you @Luigi_Servini