Solved

Get child pipes in pipe query

  • 9 February 2022
  • 1 reply
  • 197 views

Userlevel 3

I can’t get information about the child/parent pipes in Pipe query. I make a query like this one below:

{
pipe(id: "form id here") {
childrenRelations {
child {
__typename
}
}
}
}

And the only property I can get from the child/parent is __typename and the result is this:

{
"data": {
"pipe": {
"childrenRelations": [
{
"child": {
"__typename": "Pipe"
}
}
]
}
}
}

I want to know at least the child pipe ID. I tried the pipe_relations query, but it has the same limitations. The only way I could get some information about the pipes in the relations was in card query, but I need that information before a card is created.

icon

Best answer by genietim 11 February 2022, 16:45

View original

1 reply

Userlevel 7
Badge +12

I suggest looking into some GraphQL tricks. As is the case in GraphQL, in your query, you specify what you want the result to contain. Now, the problem in this query arises as the entry could be of different types. In this case, there is the trick to use `… on {Typename} {...what you want from this type}`, which lets you specify separately what you want for the different types.

E.g. a query like the following could return the child pipe and database ID:

{
pipe(id: "form id here") {
childrenRelations {
child {
__typename
... on Pipe { id }
... on Table { id }
}
}
}
}

 

Reply