Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Concetenatnation questions

Avatar

Level 8

Hello

When concatenating a couple of strings, i need to get them in 2 lines/rows on the form, like below,

my_ID + " " + my_date + " " + my_time + my_COMMENT

i need it to display like below

ABC 08-26-2011 09:08

This is my COMMENT that My COMMENT should come in next line, pls. let me know how to concatenate the above strings, pls. let me know Java Script

     Actually, i kept it like below, but not working corerctly,

my_ID + " " + my_date + " " + my_time + "                                                                                                           " +my_COMMENT

Thank you

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

the \n is a newline in javascript so your code shoudl be like this:

app.alert("This is line 1" + "\n This is line 2")

Paul

View solution in original post

3 Replies

Avatar

Correct answer by
Former Community Member

the \n is a newline in javascript so your code shoudl be like this:

app.alert("This is line 1" + "\n This is line 2")

Paul

Avatar

Level 8

Sorry, i forgot to mention that, am using variables, as below,

myFullString = my1stVariable.concat(my1stVariable + "                                                                                     " + my2ndVariable )

in this case, pls. let me know How to get my2ndVariable in next line, i mean, how to use/isert \n ?

THank you    

Avatar

Former Community Member

myfullString = my1stVar + "\n" + my2ndvar

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----