Skip to main content
New Participant
Sep 4, 2023 12:48 PM UTC
Solved

how to combine two text local variables

Hi I am Learning Appian development, i have doubt how to combine two text local variables please hep me on this

a!localVariables

(

localVar1: Text := "Hello,",

localVar2: Text := " World!" )

local!combinedText := local!localVar1 & local!localVar2

New Participant
Sep 4, 2023 2:27 PM UTC

Hi Thanks for your support,

i want to learn more things in Appian

So requesting you to help me more thanks in advance

8 replies

anmolv0003
Participating Frequently
Sep 4, 2023 12:59 PM UTC

a!localVariables(
  local!Var1 : "Hello,",
  local!Var2 : "World!",
  local!combinedText : local!Var1 & local!Var2, 
  /*or*/
  /*local!combinedText : concat( local!Var1,local!Var2),*/
  local!combinedText
)

You can use the & operator or you can use concat() function

Also : 

Anmol
stefanhelzle0001
Brainy
Sep 4, 2023 2:08 PM UTC

Using "&" inside concat() is nonsense. Concat takes any number of parameters. I changed this in my example below.

And there is no need to declare a local variable just to define the output of an expression. I see that a lot recently and really wonder where this is coming from.

a!localVariables(
  local!Var1 : "Hello,",
  local!Var2 : "World!",
  
  concat(local!Var1, local!Var2)
)

anmolv0003
Participating Frequently
Sep 5, 2023 7:44 AM UTC

Thank You , by mistake I typed it.

Anmol
mathieud0001
Genius
Sep 4, 2023 1:49 PM UTC

I personally recommend using concat() to concatenate text together simply because it is easier to collapse/uncollapse in the expression editor.

Participating Frequently
Nov 9, 2023 6:17 AM UTC

We can use concat() function in which we need to wrap both the local variables local var1 and local var2 in concat() function and for the spacing in between we can use char(32). for ex:- concat(localvar1,char(32),localvar2).