How to achieve this functionality?

HI All,

Sorry for the ambiguous title to this post - but there really was no way to explain it - but an image would show exactly what I am trying to achieve (see image below).

Currently - the data on the left hand table is from a linking table, that links the sector issues with a sector.... (tbl_link_sector_issues_and_sectors) - Screen capture below.

The data on the right hand side, is just all sector issues (tbl_sector_issues)

I'd really like to be able to

  • Select a sector (as in the screen shot below) and it shows all the sector issues for that sector (this currently works) but......
  • I'd like the table on the right to only show the 'remaining' sector issues (I.e. those not linked).
  • And finally - I'd like to be able to add or remove a sector issue from a sector using the add /remove buttons.

Edit: I think the add part is pretty straight forward. I can take the id of the sector issue on right hand table, take the id of the sector selector up top - and then create a new record in my linking table.

But removing - and keeping the table on the right more accurate (I.e. not showing the issues that are already on the left) is tricky. And makes me think there is a better way of doing this.

Can someone point me in the direction of where I should be looking to achieve this?

hope to hear,
thanks
Neil



Hi @maillme!

I set up a *similar* example on my side.

For the table on the right, I've set up some JS logic to filter out any sector issues that are already present in the table on the left:

For removing, I set up a delete query to remove the selected record from the database table shown in the table on the left. According to the above logic, once the table refreshes & the deleted record is gone, it'll show on the table on the right.

Do you think this could work for your implementation? Let me know!

1 Like

Hi Tess,

Firstly - many thanks for putting this together.
I'm going to look into it and see if i can make this work - I'll let you know!

thanks again, much appreciated,
Neil