string join

  
Hi,

I have used the string split to a string and then in the cycle loop I will check every vaule(text) which has been splited.
If the value meet the requirement, then I will merge them toghter. 
I have used a assign in the loop, like : text= text + value + ",". But it seems not work.
It shows me that the text is not definit. 
Then I try : text = value. It`s ok. How to solve this problem?
Hi,

What you wrote looks ok.
Can you post a screen shot just to see if there is something strange?

Regards,
João Rosado
Like João said, your code looks ok.
You could test the Concat() function to see if it works, but the way you are doing should also work.
João Rosado wrote:
Hi,

What you wrote looks ok.
Can you post a screen shot just to see if there is something strange?

Regards,
João Rosado
 sorry, looks ok means I can get the vaule.
When I use text = value, and show the text in the webpage, it is ok.
But when I use text = text + value + "," , it shows me that the text is not define.
 
Hi Eric,

Where do you see "not defined" - in the debugger? On screen?


Kilian Hekhuis wrote:
Hi Eric,

Where do you see "not defined" - in the debugger? On screen?

 
 I have used alert() in js to show this value. It shows undefined.
 
Eric,

I don't understand. js is client-side. You don't have access to server-side variables client side. What are you doing?
Kilian Hekhuis wrote:
Eric,

I don't understand. js is client-side. You don't have access to server-side variables client side. What are you doing?
 I have splited a string, and in the foreach loop, I have checked every value of the list.
I want append every value which meet the requirement to a local text value.
And I have used the .js alert() to check the value of the local value.
 
make sure you understand the difference between outsystems variables and javascript-variables.

what do you mean by local text value?

For example:

You have something like this in an expression

"var theTextToCheck = '" + text.Value + "';"
where text is the outsystems variable
and theTextToCheck will be your javascript variable

Solution
It's like J. said. You are probably attempting this in javascript:

alert(LocalVar);

where LocalVar is your outsytems local variable on server. Javascript will not crash, but since this variable doesn't exists in the client, it will show -undefinded-.
Solution
Thanks a lot for all the reply, problem has been fixed. It`s my mistake to fetch the value in the client.

Hi eric,

This is an important thing to realize, the difference between stuff living client side and stuff living server side. That said, the platform has powerful debugging, so it shouldn't be necessary to debug by displaying alerts!
Kilian Hekhuis wrote:
Hi eric,

This is an important thing to realize, the difference between stuff living client side and stuff living server side. That said, the platform has powerful debugging, so it shouldn't be necessary to debug by displaying alerts!
 Thank you. I want pass it to the client to javascript. I have printed this value on the webpage, and use 
getelementbyid to fetch it. Then pass it to javascript.
Is that any easy way to do it in OutSystems?
 
OutSystems doesn't provide much for JavaScript itself, but what you did seems a way to get there. Alternatively you could add the value to the actual JavaScript and Ajax refresh that.