Forums

concatenate mulitple fields for a drop-down list

Winchester 20 May, 2013
Hi,

I created a table that holds the product details which includes the prices. I made it easy for my client to be able to add/edit/delete products.

Now, I'm creating a the customer order form with a drop-down to display all the products. All the products are coffee, but with difference roasts, bean types, etc and it's not too much for a select box.

What I would like to know is how to concatenate the information from a table row. Example:

The table has:
- sku
- brand
- roast
- bean_type
- pack_size
- price

And would like the row to display all the fields (except for sku and price) so that it read out together.

- Marley Dark Roasted Whole Beans 8oz

How and where can I do this?

Any help will be greatly appreciated and thanks in advanced.

Winchester
GreyHead 23 May, 2013
Hi Winchester,

This can't be done - as far as I know - just with the DB Multi-record Loader. It needs some extra processing to build the text value. There are two ways to do this:

a) Use the DB Multi-Record Loader to get the source data, then add a Custom Code action after it that loos through the data a concatenates the values you want.

b) Forget the Custom Code action and use a Custom Code action to do the MySQL query using CONCAT() to build the value in the query.

Either will work perfectly well. I'd probably use (b) as it saves an action.

Bob
This topic is locked and no more replies can be posted.