Hi
Would greatly appreciate some help!
Im stuck with this issue, any help in understanding the error in data types would be very valuable.
Im doing a search within a search in order to get to the infromation that I need.
But Bubble says that its retriving the information in the wrong data format.
Heres a picture of the error, ill explain in words below:
I have three tables
A is parent of B is parent of C.
The way they are linked is through inverse links:
C has one field that contains elements of type B
B is another table that contains elements type A
How do I search to get from C to A correctly? Im doing a double search and getting the error above.
In more detail:
-I’m building a page that receives a single element of type A
-Within that page I have an object that loads table C, by searching for C.
-Im trying to constrain the search for C, by doing an additional search for all B items, and then for ONLY the A item that was loaded into the page.
In summary, I want to display only the C items that correspond to the A item that the page was loaded for.
I get the error message above, stating that I sent it the wrong data type.
Did I explain myself?
Thanks for any comments.
Judging by the limited error alone, you’re on the right track. The thing is Bubble doesn’t inherently know if the search your pulling will in fact produce just one row, or a whole bunch of rows. You have to instruct it. If you’re sure that your search for only just one A item will in fact return just one A item, you can add :first item to the query chain and that should resolve this error. The risk to doing this is if there’s ever a situation where it returns more than one A row, :first item will just dummy-take whichever comes first to display. You would have to add a :filter or :sort to make it more intelligent if this case ever comes up.
Thanks @anon38627393
After about 8 hours of toying around with this (since last night), by simple luck I tried doing the same search I’ve been doing with the “is in” operator, vs. the “=” operator and it worked.
Go figure…
Thanks for your interest and the super quick response!
Yes this makes sense as well, and is actually safer. This is because your Do A Search for is interpreted as a possible set of 0,1, or many values rather than a single value. (Even if it just ends up being a set of one value)
So
A = A (legal)
A = {A} (illegal (a single element can’t be interpreted to equal to a set of 0,1, or many values))
A is in {A} (legal)
The :first item action also changes {A} to just A, so
A = {A}:first value
is also legal, but more constrained
1 Like