I have a Vault (Thing) that has a field ‘Address’ (type: geographical address).
I have a Task (Thing) that also has a field ‘Address’ (type: geographical address).
A Notification (Thing) is created on the back of a Task created by a “non-host User” (see below) that includes some details from it.
A User is either a “host” or Not (identified through a field)…
I have created a relationship between User and Vault through a field (list) called ‘Vaults’ of type Vault in User.
I have also created a relationship between user and Notifications through a field (list) called ‘Notifications’ of type Notification.
What I want to achieve is the ability to only display a notification to a User (Host) where the Task (Address) is within eg; 10km from the Vault (Address)…
to answer your question, the trigger is when a User (Host) navigates to their “Notifications” they will be shown only those notifications that relate to a Task that was created within say; 10km of the location of their associated Vault location.
Just to put more context to this…
A geograhical area may be serviced by many Hosts (User) which is associated by the location of their Vault (thing).
So, the idea is that when a task is created (by a non-host) that falls within their serviced area, all those applicable Hosts only would be able to see this Notification (eg; Task detail) with an opportunity for them to Accept or Reject the task.
I think you have made life a little hard for yourself with the “Notification” datatype. It doesn’t link to a task (because type is a text not a task) so it is going to be hard to navigate easily.
Maybe if we start off simple and try to display Tasks that are within 10km of the Vault address.
That should be possible, as long as you can point to a single address for vault (so the User has a single vault, or chooses from a list).
What would be quite difficult would be a list of vaults, and asking “show me any task with an address within 10km of any of the vaults in this list”.
Can you please confirm the addresses are indeed what you think they are (for the tasks and the user’s vault) using the debugger? Run Step by step and you’ll be able to inspect each value at runtime.
I was able to achieve what I was aiming for. I specified two separate queries and merged them at the the Repeating Group level.
A question though, how can I now sort the merged list? applying the sort applies it to each list individually, thus it lists the results in order followed by the next list result.
In action as shown on the screenshot below, I am counting the List of ‘Boxes’ and comparing that to the ‘Box_Qty’ in Task.
eg; IF the list of Boxes count is 0, 1 or 2, THEN I am creating a new Box thing and adding to ‘Boxes [List]’ ELSE do nothing.
The issue I have is that the criteria belows ALWAYS allows for the creating of an extra record, eg; if Qty = 2, it allows to save a third one, if Qty = 3, it allows to write a fourth one before doing nothing…why is that the case?
Apologies for the late reply. As a first step, please use the debugger and run this step-by-step, then inspect the Box counts (by clicking on them while paused) to make sure the values you see are what you expect.
Let me know if that provides any further insights, glad to help if still unclear.