+ Start a Discussion
OFA_SchlicksupOFA_Schlicksup 

Concatenating values into a Variable

I seem to remember learning this at some point but cannot find it. How would you (if possible) concatenate two values (ideally two input fields) into a variable?

 

Example Case - I have a Form Question for State and a Form Question for Expense Type. I want the Variable to grab the State value and the Expense Type value and concatenate so I can allocate that to a text field. Similar to merge fields I guess.

 

Can this be done?

Best Answer chosen by Admin (Salesforce Developers) 
OFA_SchlicksupOFA_Schlicksup

Thanks for the direction. In case anyone else stumbles upon this, to clarify my eventual solution:

  • My two inputs were allocated to variables, var1 and var2.
  • I created a third variable, varSPACE, and hit the space bar once in the area where you input the initial value of the variable.
  • I created an Allocation element (that what it's called in the desktop version, it may be called Assignment in the Cloud Flow Designer) with the three variables, using the Add function instead of the default Equals, in the order I wanted them to appear [var1 varSPACE var2].

All Answers

Sfdc profSfdc prof

Hi,

 

You can do this by using "Assignment" Element.

just create a temporory varible, and add all the User inputs to these variable through Assignment varible.

 

thanks

RajaramRajaram

To be more specific, use the "add" operator

OFA_SchlicksupOFA_Schlicksup

Thanks for the direction. In case anyone else stumbles upon this, to clarify my eventual solution:

  • My two inputs were allocated to variables, var1 and var2.
  • I created a third variable, varSPACE, and hit the space bar once in the area where you input the initial value of the variable.
  • I created an Allocation element (that what it's called in the desktop version, it may be called Assignment in the Cloud Flow Designer) with the three variables, using the Add function instead of the default Equals, in the order I wanted them to appear [var1 varSPACE var2].
This was selected as the best answer
basicquestionsbasicquestions

I am dealing with a similar issue, but I cant seem to get the varSPACE variable to respect the space.  I want the following format: var1 - var2.  I've tried the Assignment with three variables, but the varSPACE variable doesn't seem to work so I get var1-var2.  Did you do anything other than hit the space bar in the default value field for varSPACE?

OFA_SchlicksupOFA_Schlicksup

No, I did nothing other than hit the space bar in the default value field for varSPACE. If you are trying to set " - " all in a single variable, it may choose to read that simply as "-" (ignoring space as it does in APEX). It may be necessary to split that into two variables:

  • varSPACE --> " "
  • varDASH --> "-"

And then use the Add function in the Allocator as var1 varSPACE varDASH varSPACE var2.

basicquestionsbasicquestions

Thanks for the reply.  I tried that too, but it didn't work for me.  For some reason it is ignoring the space I set in the varSPACE variable. (Perhaps Cloud Designer doesn't respect the space variable in the same way.)

OFA_SchlicksupOFA_Schlicksup

I haven't played with the Cloud Designer yet (from what I hear, it's slicker but offers less functionality), so I have no further insight. Maybe add a space at the end of var1 and at the beginning of var2? Just guessing at this point. It is frustrating to get stuck with some functionality that seems so obvious.

Jeff TalbotJeff Talbot

Similar issue as basicquestoins - trying to get a space between first and last name to populate a variable for "FullName". I tried assignments, variables, constants... none of them worked, the space never rendered.

 

Here's what worked for me: I added an extra Screen, and in that Screen I added Display Text which I labeled "FullName". In the Display Text, I added the first and last name screen input fields with a space between them.

 

Now, "FullName" appears in Resources as a Screen Output Field. I can access and render the FullName in the Flow with the desired result (a space between the first and last names).

 

I did not connect the extra Screen to any other Elements in the Flow. Seems strange that it works without being connected. But it does.

goravsethgoravseth
Sarah HamblingSarah Hambling
Concatenating  Variables from Visualflow and adding a space between values.

The advice given by OFA_Schlicksup was very useful, however I experienced the same issue as some other users, entering the space in the variable field did not work it was just ignored.

After some perseverance I found that entering the value of the space as ASCII worked. 

Holding down "Alt", typing 255 on your numeric keypad, then releasing "Alt."

I then added the variable varSPACE into a text template and using the assignment "Add" generated the required space.