Expand my Community achievements bar.

SOLVED

Text variables - and formatting

Avatar

Former Community Member

Hi folks,

Just wonder if you can/how you store text in variables with some degree of formatting.

The problem - my user selects, for example, I own a "dog" and gets the variable text:

We see that you own a dog. We'd like to sell you a bunch of crap for the purposes of making a bunch of money off of your affinity with your animal. This example is deliberately several  lines long so you can get my point and included arbitrary text arbitrary text arbitrary text  arbitrary text  arbitrary text  arbitrary text  arbitrary text  arbitrary text  arbitrary text  arbitrary text  arbitrary text"

i.e. while the variables are useful for storing "canned text" as it were, the layout on integration is not great;

so can we 

Store the text in variables with line breaks/new sentence breaks included, so that our text above would readL

We see that you own a dog.

We'd like to sell you a bunch of crap for the purposes of making a bunch of money off of your affinity with your animal.

This example is deliberately several......................

so that it is more useful on reintegration.

Fyi --In our form once the list selection is made the variables values (the canned text) are assigned to textbox.

Any pointers appreciated. Mostly if we could get clean sentence breaks that would be a good start

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Is this the effect you are after?

Untitled.png

Here is one approach.

// form1.page1.subform1.bodyText::calculate - (JavaScript, client)

if (form1.page1.subform1.pet.isNull) {

  this.rawValue = null;

}

else {

  this.rawValue = "We see that you own a " + form1.page1.subform1.pet.rawValue + "." + "\n\n"

    + "We'd like to sell you a bunch of crap for the purposes of making a bunch of money off of your affinity with your animal." + "\n\n"

    + "This example is deliberately several.....................";

}

Steve

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

Is this the effect you are after?

Untitled.png

Here is one approach.

// form1.page1.subform1.bodyText::calculate - (JavaScript, client)

if (form1.page1.subform1.pet.isNull) {

  this.rawValue = null;

}

else {

  this.rawValue = "We see that you own a " + form1.page1.subform1.pet.rawValue + "." + "\n\n"

    + "We'd like to sell you a bunch of crap for the purposes of making a bunch of money off of your affinity with your animal." + "\n\n"

    + "This example is deliberately several.....................";

}

Steve

Avatar

Former Community Member

Thanks Steve,

I was trying to wrap it all up into one variable as it were (formatting included) but this will work nicely too.

cheers

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] ----