If I assign a white space string to variable, after run, it result error


Just simple create one assign activity, then var = “ “, one space inside double quote.
run it and get error message:

By using Studio Community, version 2024.10.1

@KennyLee,

Try changing the name of the variable.

var would be reserved keyword.

Thanks,
Ashok :slight_smile:

same, when I change the name of var to var2, or x, or else.

@KennyLee,

Ok let me try reproducing it. It’s weird error. :smiley:

Ohh wait!! you have used it incorrectly in Write line. It should be "["+var+"]"

Hi @KennyLee

"["+var+"]"

image

Hope it helps!!

Not related to Write Line activity, error when only one assign activity:

@KennyLee

"[" & var & "]"

image

Hi @KennyLee

It not works for you, instead of initializing the space better to initialize the variable with String.Empty.

- Assign -> var = String.Empty
- Assign -> Ouput = "["&var&"]"

Check the below image for better understanding,

Hope it helps!!

In my test, empty string is OK, error when one space, or two space…

Hi @KennyLee

Can you try this

image

Regards,

I retry it from another environment, Enterprise license, version 2023.10.7
I got same error result:

For var2 = " " + " "
It is OK

@KennyLee

Try this, It is working

image

Regards,

1 Like

@KennyLee

Try by giving in the default value of variable panel ,It is working

1 Like

Hi @KennyLee

How about the following?

New String(" "c, 1)

Regards,

1 Like

Thanks to all of your “workaround” solution, but I just want to report it’s a “bug”.

4 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.