Creating a Button That Goes to Table with only Linked Records
I have been searching endlessly and can't find the correct formula.
I want to create a button that when you click on it, it will display the child table but only the linked records to that specific record I am viewing in the parent table.
Example (Parent Table: Clients) ***Button is View Full Chronos***
 
 
Then when clicking on it, it will bring up the Child Table: Chronos and only display records from Client ID 10970 for example:
 
 
Any help is greatly appreciated.
26 replies
- 
  
Hi David
Have a look at this post I put up about Virtual Lists
https://forum.ninox.com/t/m1hrzt8
It's not exactly what you describe above, but the end result is essentially the same.
Hope this helps
Regards John
 - 
  
Sorry John Halls I had difficulty understanding the applicability to my specific problem. I want this to be for every single client record as every single client record has "chrono" records which are stored in a child subtable. I just want a way where a user can simply click on a button within a client record to view only that client's chronos without having to open the whole child substable and search for that client either by name or client ID.
 - 
  
Since you have a Chronos view, why do you need to open the Chronos table at all? The view shows them the same information as they would by opening the table separately.
 - 
  
Hi David
Here's an alternative way.
- Add a new field to your child, lets call it Subset
 - Add a new child view (let's call it By Client) that matches the existing view but swapping out Client ID for Subset. Rename the column Client ID.
 - Set a filter on Subset to !=null (which means not empty)
 - Add a button on the client table with the following code
 -  
for a in select Chronos where Subset != null do a.(Subset := null) end; for b in Chronos do b.(Subset := b.'Client ID') end; openTable("Chronos", "By Client") 
I tested this on a db with hundreds of child records per parent and it was a bit slow so I played with speeding this up using do as server but with mixed results. I also tried setting the binding of Subset to Per record in memory, again with mixed results but this would be the better option as it makes the solution suitable in a multi-user environment.
Let me know how you get on.
Regards John
 - 
  
Got the do as server version to work consistently.
do as server for a in select Chronos where Subset != null do a.(Subset := null) end; for b in Chronos do b.(Subset := b.'Client ID') end end; sleep(1000); openTable("Chronos", "By Client")It wasn't waiting to finish the loops before opening the table. Adding a sleep command allows it to catch up first and then open the table. 1000 = 1 second. You may not need to to wait that long in your solution, if at all.
Regards John
 - 
  
Alain Fontaine I'd just done the same, may as well include it too!
 - 
  
David Irving Hi David. Did we answer your question in the end?
Regards John
 - 
  
Sorry John Halls I was dealing with COVID and have just got back to this. I am going to try some of these solutions and get back to you. Thanks so much!
 
Content aside
- 3 yrs agoLast active
 - 26Replies
 - 788Views
 - 
    5
    Following
    
 
