Skip to main content
Solved

Database ID in pipe query

  • December 30, 2021
  • 2 replies
  • 269 views

william-kliemann

I have a situation and I can't find a solution.

I need to make a query to filter a pipe, but in it, I need my client's ID that is filled in it in the databases.

That is, I need the pipe query to bring the ID filled in it in the databases.

Has anyone been through something like that?

Best answer by genietim

I am quite unsure if I correctly understood your situation.

Let me try to phrase what I understood: you have a pipe and a connected database, “clients”. Now, what you want to do, is to query the cards in the pipe which have a certain connected client.

Is this correct?

Then I would suggest to approach from the other way: you can query the database entry (the client) with all its connected cards (meaning, the cards in the pipe and possibly other pipes and databases the client is connected to), and filter the cards to only use the ones from the pipe you want afterwards.

Example query:

query {
    table_record(id: <theTableRecordId>) {
        title,
        id, 
        status {
            id, name
        },
        record_fields        { 
          name, value, array_value, field { internal_id id }
        },
        parent_relations {
            id, name, repo_items {
                edges {
                    node {
                        ... on Card { id, title }
                        ... on TableRecord { id, title }
                    }
                }
            }
        },
        status {
            id, name
        }
    }
}

Adjust the inner workings (i.e. on Card … fields) to your likings — that’s where you will find the cards of the pipe(s).

View original
Did this topic help you find an answer to your question?

2 replies

genietim
Forum|alt.badge.img+12
  • Pipefy Legend
  • 412 replies
  • Answer
  • December 30, 2021

I am quite unsure if I correctly understood your situation.

Let me try to phrase what I understood: you have a pipe and a connected database, “clients”. Now, what you want to do, is to query the cards in the pipe which have a certain connected client.

Is this correct?

Then I would suggest to approach from the other way: you can query the database entry (the client) with all its connected cards (meaning, the cards in the pipe and possibly other pipes and databases the client is connected to), and filter the cards to only use the ones from the pipe you want afterwards.

Example query:

query {
    table_record(id: <theTableRecordId>) {
        title,
        id, 
        status {
            id, name
        },
        record_fields        { 
          name, value, array_value, field { internal_id id }
        },
        parent_relations {
            id, name, repo_items {
                edges {
                    node {
                        ... on Card { id, title }
                        ... on TableRecord { id, title }
                    }
                }
            }
        },
        status {
            id, name
        }
    }
}

Adjust the inner workings (i.e. on Card … fields) to your likings — that’s where you will find the cards of the pipe(s).


genietim
Forum|alt.badge.img+12
  • Pipefy Legend
  • 412 replies
  • December 30, 2021

You may need to look into pagination if your clients can have more than 50 connected cards.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings