Select to view content in your preferred language

How to include a newline when concatenating?

4426
6
Jump to solution
03-29-2017 07:43 AM
by Anonymous User
Not applicable

Hello all,

In my survey I have the user choose an account ID (txt_Acct_ID) from a list which then auto-populates a number of answers from a csv file.  In the case of a Mailing Address pre-populating a multi-line textbox, I am trying to concatenate a number of separate fields from the csv with newline calls injected.  Example:

MailAddress1

MailAddress2

City, State Zipcode

Here is one thing I tried:

if(${int_ID_sel}>0,concat(pulldata('feed_mans','MailAddress1','AccountID',${txt_Acct_ID})+'\n'+pulldata('feed_mans','MailCity','AccountID',${txt_Acct_ID})),'')

The result is:

MailAddress1\nMailAddress2

So it appears not to recognize the newline call.  I have a number of workarounds but would like this to work if possible.  The use case is to pre-populate the field but allow the user to update it.  And for this purpose, it actually makes the most sense to put the entire address in one field.  

Thanks!

Jim

0 Kudos
1 Solution

Accepted Solutions
JamesTedrick
Esri Esteemed Contributor

Hi Jim,

Is it providing the 'MailAddresss1' literally, as in the pulldata is not working?  If so, try placing them in calculate fields.  '\n' is working for me in calculations - a simple sample:

typenamelabelappearancecalculation
texttext1Enter some text:
texttext2Here's a multiline:multilineconcat(${example},"\n","hello")

View solution in original post

0 Kudos
6 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Jim,

Is it providing the 'MailAddresss1' literally, as in the pulldata is not working?  If so, try placing them in calculate fields.  '\n' is working for me in calculations - a simple sample:

typenamelabelappearancecalculation
texttext1Enter some text:
texttext2Here's a multiline:multilineconcat(${example},"\n","hello")
0 Kudos
by Anonymous User
Not applicable

Hi James,

The pulldata is working great.  I just was using the 'MailAddress1' for this example.  It seemed clearer when I wrote it.  I do have it in the Calculate field but it was not working with single quotes.  I just replaced the single quotes with double quotes only on the \n and that gave the newline in the text box.  So here was the final calculation:  

if(${int_ID_sel}>0,concat(pulldata('feed_mans','MailAddress1','AccountID',${txt_Acct_ID})+"\n"+pulldata('feed_mans','MailCity','AccountID',${txt_Acct_ID})),'')

I just simply got the quotes mixed up.  

Thanks for the quick reply!

-Jim

FieldUser1One
Occasional Contributor

Does this work in the Web App version for use in Experience and Dashboard Editors?

For me the Newline ,"/n", works great on the field app, but not on the Web App, which simply shows:

\n\n, Coldwater, RoW Status: Clearing, Grading; TEL Assessment Status(s): 3 (SM) \n\n Bedrock

Using code:

concat('Bedrock Type:',${Bedrock_Type},"\n",'Observed from: ',${Bedrock_KPRge},"\n",'Bedrock Depth: " ',${Bedrock_Depth},' m, Bedrock Depth Range: ',${BedrockDepth_Rge},"\n",${Sample_Reason_Cct},'; # Samples: ',${Nmbr_SamplesPerActivity})

0 Kudos
EllenLester
Occasional Contributor

Is there any workaround/update for adding newlines for surveys accessed through the web app?

0 Kudos
RHammers
Occasional Contributor

@FieldUser1One Did you ever find a way to get this to work in the web app?

0 Kudos
AndyBates
Regular Contributor

As long as appearance column is set to "multiline" using concat with "\n" works ok for me. ie  concat(${initials}, "\n", ${surname )

AndyBates_0-1668005583673.png

 

0 Kudos