Forum Academy Marketplace Showcase Pricing Features

Data structure query & search criteria

Hi,

I am struggling with listing just the Tasks that are within a range of a Vault, please help?

this is my data structure.

User has a List of Tasks (Task has an Address)
User has a List of Vault (Vault has an Address)

In a repeating group I am displaying all the Vaults associated with Current User.

When the user clicks on a particular Vault I want to ONLY display the Task which are within x miles from that selected Vault.

The following not only is highlighted in red, which makes me believe there is an issue, but it still runs, and when I click on a Vault the results displays ALL the Tasks regardless of their distance from the Vaults.

please help?

That will be a list of addresses I think, you need a single address to search with a distance.

So it depends on how you are doing the “click on vault” part, but that is the Vault you want to put in the search, not the list on the User.

How does the user select a vault ?

Thanks @NigelG

I must admit, this seemed to have broken when I changed the Vault field to a List, as we made a decision to allow a user to create more than one Vault.

I am displaying the list of Vaults that is related to a User on a repeating group as such;

I then have a simple shape that when clicked navigates to the repeating group as mentioned on my first post above.

That makes sense.

So you will need to get a single Vault from one Repeating Group to another.

You could do this by setting a Custom State when the Vault is clicked (so to the Current Cell’s Vault’s Address).

Or you could put the Task RG into a Group, set to have a Content Type of Vault. And then on click you do a “Display Data” on the Group with a Value of Current Cell’s Vault’s Address.

excellent - thanks @NigelG using a custom state has worked.

so @NigelG just when I thought I had gotten my head around dealing with Things :slightly_smiling:

can I ask…generally speaking, how can you make changes to a Thing when the group Type of where the event/action is triggered from is not the same type as the Thing you are trying to update/change?

as an example, the next step of the process above is to display the Task details, which I have done in a group of type Task, an input filed for Box number and an Add Button should then trigger the following updates but I am struggling to achieve:

  • update Box (thing) fields; Seeker (User that created the Task) and Task
  • update Task (thing) fields; Boxes (List of type Box), it should be the number entered in the input field

I think you would need to leverage your data structure here.

You make your life a lot easier by having data types (parent / child) embedded in your things.

So … if you know Box, for example. And a Box only has one Task. And you have a field “OwningTask” on your Box.

Seeker … Box’s OwningTask’s Creator = user that created the task.

Boxes … Update LIST of things … Task’s Listof Boxes

@NigelG I believe I have the correct parent/child embedded in my Things.

Here is a simple update that I’d like to achieve and was hoping for some help…

In ‘Box’ (thing) I have a field called ‘OwningTask’ of type Task.

In a group of Type: Task I am displaying the task details, there is an Input Field for a Box number and Add button.

When the Host which already has been associated with the displaying task enters the box number and clicks Add.

The action needs to search for the Box number entered in Box (thing) and update the ‘OwningTask’ field with the task being displayed.

In the screenshot below I am initially searching for the Box_number that matches the one entered in the input field.

Issue here is that it appears that the ‘Search For’ return a List of boxes and its throwing an exception.

after so many hours later I managed to work this issue out.

I figured out that as all searches come back as a list of Things, in my case above I am being explicit about the item that should return so I am confident that the list only contains one element and therefore can specify that I am wanting the :first item

this seems to work perfectly! :slightly_smiling:

2 Likes

Glad you sorted it :slightly_smiling:

That is a common Bubble search issue, no matter how much you know it will return a single thing … a search is a list as far as bubble knows.

1 Like