Where do you call pd1() in your script? There is a declaration of the function but no actual function call in your example, is this a mistake or on purpose?
From the reply below, the only difference is the inclusion of server.(getVariable)(setVariable). Can the script tags exist with out it, for example just declaring a function isn't allowed?
Why does the tag <@SCRIPT EXPR="pd1('01')"> actually work? If you execute this the second script call actually returns the parsed string.
-B
On Saturday, July 26, 2003, at 12:01 AM, Ben Johansen wrote:
You need to interface with server side scripting using the
• server: object representing Tango Server.
• getVariable(name): gets Tango a variable. Using default scoping rules, returns variable value.
• getVariable(name, scope): as in the previous paragraph, but defined with scope.
• setVariable(name, value): sets a Tango variable, using default scoping rules, returns nothing.
• setVariable(name, value, scope): as in the previous paragraph, but with defined scope.
as noted in help for <@SCRIPT>
you need to change it to...
<@ASSIGN?request$ScriptIn VALUE='Your Value Here'>
<@SCRIPT SCOPE="Request">
var?d= server.getVariable('ScriptIn', 'Request');
function pd1(d)
{
if(d.charAt(0)==0) {
nd = d.toString().charAt(1);
server.setVariable('wnd',nd, 'local');
}
else
{
nd = d.toString();
server.setVariable('ScriptOut',nd, 'Request');
}
}
</@SCRIPT>
@@request$ScriptOut
Ben Johansen - http://www.pcforge.com
-Authorized WiTango Reseller
?http://www.pcforge.com/WitangoGoodies.htm
-Authorized Alt-N Reseller
?http://www.pcforge.com/AltN.htm
-----Original Message-----
From: Bryan Hughes [mailto:[EMAIL PROTECTED]
Sent: Friday, July 25, 2003 8:31 PM
To: [EMAIL PROTECTED]
Subject: Witango-Talk: <@SCRIPT> generating UNDEFINED
Using code below in a TAF returns undefined.
<@SCRIPT SCOPE="Request">
function pd1(d) {
if(d.charAt(0)==0) {
nd = d.toString().charAt(1);
return nd;
} else {
nd = d.toString();
return nd;
}
}
</@SCRIPT>
<br>
<@SCRIPT EXPR="pd1('01')">
The results are:
undefined
1
Am I misunderstanding the abilities of the Witango server side javascript?
I'm on Witango Win 5.0.1.054
