Does anyone know how to convert an object into a text value? I'm using a hook to combine multiple fields and I'm trying to include a reference field. All I can get it to show me is [object Object] for each referenced data point.
Any ideas?
export function EventPhotos_afterQuery(string) { string.search = string.categories; return string; }
Try something like this:
$w.onReady(function () { $w("#yourDataset").onReady( () => { let itemObj = $w("#yourDataset").getCurrentItem(); $w('#text1').text = itemObj.tba_no; } ); });
Or you can try using JSON stringify to convert object to string, see links below for more details:
https://stackoverflow.com/questions/5612787/converting-an-object-to-a-string
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
Hi, so I have two collections - one with events and one with categories. They have a many to many relationship. I'm trying to set up a database search field that can show results in my Events collection based on related Categories as well. So, if someone searches "weddings" for example, Events that include the word "weddings" in its category reference field will show up.
I've tried several things to accomplish this, like using the "include" function in my query, concatenating multiple queries (which doesn't make sense for what I'm trying to accomplish), and I haven't gotten anything to work. I decided that the best solution might be to make a combination field that strings together all keywords that I want to be searchable, including the referenced categories. Unless you can think of anything else that might work.
Hi,
What are you trying to achieve? What is the use case?
Please share more information so we can assist you.