Heads up! On March 5, starting at 4:30 PM Central Time, our community will be undergoing scheduled maintenance for a few hours. During this time, you might find the site temporarily inaccessible. Thanks for your patience. Read more.
×Hi,
given the following forms:
I want to make a tableview for devices, showing the fields of the form + a field showing a list of all the locations of that specific device on the hardwares form.
Currently I use:
id.queryAndSet(hardwares:@self;device:[entry.id];location)
which works, but since one location can have several occurrences of the device, I get a list containing duplicates.
Is there a way to filter the duplicates out of the output?
another thing I tried was making a queryAndRender table showing each location and the count of occurrences of the device in the location, but I meet the same issue there.
Currently I used the following solution (not great, but works):
I added two formula fields to the hardwares form:
countperlocation: (for each hardware entry, counts the amount of the same device on the hardware's location - will be a duplicate for every entry on the same location)
[entry.id.queryCount(hardwares:@self;device:[entry.device] AND location:[entry.location])]
numperlocation: (similar for the one above, but only count the devices if they were created before the current entry - which in a ways gives them a "serial number" for their location)
[entry.id.queryCount(hardwares:@self;device:[entry.device] AND location:[entry.location] AND created:<[entry.created])]
and on the queryAndRender field I used the following: (show for each location just the first hardware of the same type in the location, and the countperlocation which as said above is duplicated for each of the hardwares)
id.queryAndRender(hardwares:@self;device:[entry.id] AND numperlocation:0;location|countperlocation;table)
Will be happy to hear better solutions!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.