Concatenate data inputs

Hi Forum,

I’ve seen a couple indirect comments relating to concatenating data types, but not a great explanation on how to do it without changing the data. I’m looking to take certain data inputs, store those, and then combine them with other data elements into a single text string to produce new data types. For example, let’s say we were building an app that helps people find their favorite desserts nearby. One input field is “flavor” and the other is “type of dessert.” If the user’s favorite dessert is “chocolate ice cream”, they’d input “chocolate” in one field and “ice cream” in another. I want to store all the times people input “chocolate” into the fields, every time they input “ice cream,” and then store the concatenated “chocolate ice cream” as a separate data field.

Ultimately, the goal is to run the concatenated creation against an API (e.g. Google Places) to find nearby “chocolate ice cream”. I’m not sure Google Places actually does this, nor is this the actual app I’m building, so no need to comment on whether this search will work with the Places API.

It seems there may also be a way to do this using Zapier or Blockspring, but having a little trouble/would prefer to keep in the Bubble database for now if possible. Thanks!

Not sure if you really need to store the data if you’re just performing a search, but if that’s a requirement then there’s potentially multiple ways to do this. Two I can think of are:

Option 1: In your table (data type) have three columns with “field 1”, “field 2”, and “concatenated field”. Use workflow to create a new record (thing) in the table when someone searches or submits the fields they’ve selected.

Option 2: Use a metatable (data type). This can allow you to simplify the structure of the main table and store associated data with a reference. In my system I use post_id from the post table and add it to all post meta table items. This requires a little more workflow to implement, but it keeps the post table a little cleaner.

Post table

Post Meta table

Post Meta table showing multiple meta records related to two posts

This post might help with your question, if I understand it correctly: