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;
}
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.
It tells me that cell value type is JS object, but when I click “change to text” I lose all the data. Is there a way to just get this to be one long string? Really the only thing I’m interested in is “title,” can I just get those values converted to a text string?
@ givemeawhisky Thank you for the information… I am sorry I should have been more clear in my comment. I am trying to get rid of the JS object, my field is suppose to be a reference field, and for some unknown reason to me it converted to a JS object… Any suggestion how to fix this?
I am thinking my reference field is not getting the context.
@emsimmons77@givemeawhisky Eventually I just used JSON.stringify and a hook to copy over the data from the reference field into a plain text field. It seems to be working, though I’d really like to find a way to just select the title field and copy that over for each referenced item, rather than the entire row of data for each item.