Text Concatenated from A List of Things

Hey Everyone…

So I have a list of Things which are of type Payment Method - which has fields Method and User Message. So typical values are:

Paypal
Please pay into my account me@mail.com

Bank Transfer
Please transfer to account XYZ.

I want to concatenate all this text into one field which can then be sent in an email, and I want to do it with the least impact on performance - so with as few a searches and hits on the database as possible.

Thankfully there will never be more than about 6 items in a list.

My current approach is to use a normal workflow, assign a state This Payment Method, and concatenate the content of its fields to a state Payment Method Text. The concatenation is not obvious how to do with state assignment, but I have a solution to that using the “Current Date Time is not empty:formatted as text” method, dreamed up by @keith.

I would be intrigued to hear if anyone else has a different solution!

If you have a list of Payment Methods:

List-of-payment-method’s User Message

… is a concatenated list of the User Messages. They are separated by commas by default. Add the :join with operator to modify the comma space to something else. (Not sure if u can make the join character a newline character but worth a shot. If not join with something unique and :search and replace that with manual newlines.

(My point is: be smart about what you save in User Message field and you are done.)

1 Like

Hey @keith

Thanks for that input!

I found a solution by adding a third field to the type definition and populating it when a new type definition is saved:
Payment Method:

  • Method (eg. Paypal)
  • User Message (e.g. Please pay into my account me@mail.com)
  • Payment Method Text (e.g. Paypal - Please pay into my account me@mail.com)

Then I used your join operator to concatenate the different Payment Method Text values for my list of Payment Methods I want to appear in the message.

Actually, for new lines I have issues crop up here and there so I have used the App Text () feature and defined CR and CRx2 items to be single or double new line characters.

Thanks for your ideas! :slight_smile:

2 Likes

That’s a cool tip on using app text for newlines/carriage returns! :+1:

1 Like

Glad you like it! :slight_smile:

1 Like