Concatenate values in DB

Hi forum,

I need some help with something I think should be possible. I just don’t know how.

In a database I have a column for country and one for city. I want to concatenate these in a third column, so I get a string called “City, country”. This concatenated column I want to use to pull in latitude and longitude via api.

(Or maybe an address field is better?)

Anyway, I still need to concatenate. Can I do that?

Thanks

If these are all simple text strings, you can set up a joined string easily. This illustration may help you out:

image

So you basically just make changes to a Thing, and put a comma and space in between the two dynamic values.

2 Likes

You can do what @petter showed you in an API Workflow as well to run a bulk edit on all your records. Set up an API Endpoint with a parameter for the data type you’re editing and go to Data > App Data > select your data type and then click on Bulk to run the API Workflow on that list of records.

2 Likes

You received 2 great responses, but just to consider things from a slightly different angle… Does your use case preclude the possibility of performing the concatenation at the time you “pull in” the lat/lon? Generally speaking, it’s “better” to avoid data redundancy by keeping the DB as “normalized” as possible (or practical).

1 Like

I think this is my way forward here. I’m sure there is a useful video-tutorial on youtube somewhere for ‘setting up an API endpoint’. :wink:

Thanks for the great answers, all

What I’m trying to achieve is a something like this, but with a twist: if one of the cells is empty it returns a space.
Example: I like to store a full name. Input First Name, input Last Name -> write to DB Full Name = First Name’s value ^space^ Last Name’s value. Result is then ‘John Doe’. But if Joe didn’t fill in his first name, the result would be ’ Doe’ -> notice the unwanted space in front of Doe.

Q: How can I run a test to see if an input is empty and then not use this value at all? I’ve tried this with the :append option, but then I can’t put a space in between the name’s.

You can use Append to just enter a blank space.

Screenshot 2020-11-26 at 9.42.21 AM

A test for blank space is just do a search using “is Empty” for the field.

To record data in a field with an empty space in front, just enter space before you insert Dynamic Data. Example shown below:

Screenshot 2020-11-26 at 9.46.33 AM

Thanks for the help, Kaventan1.

I’ve added an extra step after ‘Sign the user up’: make a change to the user only when cell is empty. So originally the full name is stored but when First Name is empty, change it to just the Last Name.