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!
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.