Explained: create a 1:N relation and filter chosen items out

Forums Designer Building applications Explained: create a 1:N relation and filter chosen items out

  • Post
    Alex Schilder
    Participant

    Dear fellow-Creators,

    I’ve twisted my head around something for a while, which is how to be able to create a 1:n relation in Triggre, but filter the already chosen items out of the list with ‘items to choose from’.

    In my case, I’ve created an application for IT service suppliers, which has an user-flow which is based on the datatable ‘Request’. Each request can have, for example, multiple drives, printers, applications etcetera, which are stored in datatable ‘RequestDrives’, ‘RequestPrinters’, RequestApplications’ etcetera.

    So what I’ve done is this:

    You first got a page, button and flowpart where you create a Request ofcourse.

    Then afterwards, you’ve got a button which sends you to a page like this:

    https://prnt.sc/rfwwm7

    We’ve got a dropdown/select where we can select one organisation from datatable Organisation.

    If we’ve chosen an organisation, you can add the organisation by clicking the button ‘add organisation’, which triggres the flowpart ‘create RequestOrganisation’, which has got the inputs ‘Request’ and ‘Organisation’ where Request is the created Request and ‘Organisation’ is the selected Organisation in the dropdown/select.

    https://prnt.sc/rfx56k

    Now, the trick is to filter the already selected/chosen organisation (see the records in the table ‘Gekoppelde organisaties’) out of the dropdown/select of ‘Organisation’, so you prevent users of creating unnecessary double records:

    https://prnt.sc/rfx6o5

    This is done by using the following filter (credits to Jochem for helping me out on this one):

    • Use a function which checks if list A contains B
    • So we’ve got a function which is:
      • LIST Request/RequestOrganizations/Organization CONTAINS Organization = FALSE
        • Where the LIST is the Request from the userflow, then the linked RequestOrganizations (which is linked in de datamodel), en then the ‘Organization’ which is linked.
        • Where the ‘Organization’ of the ‘CONTAINS’ part is simply the ‘Organization’ property ‘Organization’
          • https://prnt.sc/rfxd6c
        • To clarify, you need the = FALSE statement, because you’re checking whether the organizations shown in your dropdown/select IS NOT in the list of already linked RequestOrganizations of this Request.

    If you found this helpful, please let me know by hitting the +1, it might stimulate me to share more of these tricks.

    If there’s a question about something, let me know and I’ll try my best to respond to your question.

     

Viewing 1 replies (of 1 total)
  • Replies
    Jochem Spronk
    Moderator
    Up
    0
    Down

    Hi Alex,

    Thank you for clear explanation. It’ll be appreciated.

    Jochem

     

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.

Get started for free and experience the power of the Triggre platform.

By signing up for your free account, you agree to receive e-mails from Triggre.

By using our site you agree to our use of cookies to deliver a better site experience.