Jump to content

Joining multiple records in a single string


Recommended Posts

  • Newbies

Hi,
I wonder if someone might be able to help me. We own a pub and I am trying to collate all our recipes. Among other things, I want to print labels that we stick on to any pre-made items, but would like to include all the ingredients. I've got a table for the menu and then a related table that lists all the ingredients. Is there a way of bringing the list of ingredients into one single string like you see on food packaging. The labels can't be too big so listing them a line each would be too much.
Thank you!

Link to post
Share on other sites

If recipes - < ingredients ( recipes are related to ingredients, one to many), then you can use List () to gather the related ingredients names. Then you can wrap that in Substitute() to replace the carriage returns with commas. 

 

Substitute (     List ( "apple" , "banana" , "pear" ) ;     ¶ , ", "  )

 

you'd have: Substitute ( List ( relatedIngredients::name) ; ¶ , ", "  )

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.