<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
<br>Yes, as I discovered. :/<br>I was trying to make it easy on myself by passing a parameter which doubled as a link which doubled as a title which keyed the definition, etc.<br><br>I've gotten around it by using underscores for spaces and stripping the underscores where needed for display.<br><br><br><hr id="stopSpelling">Subject: RE: [Xerte] Accessing associative arrays via variable?<br>Date: Wed, 30 Dec 2009 16:24:30 +0000<br>From: Julian.Tenney@nottingham.ac.uk<br>To: xerte@lists.nottingham.ac.uk<br><br>
<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</style>
<div id="ecxidOWAReplyText8094" dir="ltr">
<div dir="ltr"><font size="2" color="#000000" face="Arial">I wouldn't use spaces in names at all</font></div></div>
<div dir="ltr"><br>
<hr>
<font size="2" face="Tahoma"><b>From:</b> xerte-bounces@lists.nottingham.ac.uk on behalf of Dave Burnett<br><b>Sent:</b> Wed 30/12/2009 14:23<br><b>To:</b> Xerte list<br><b>Subject:</b> RE: [Xerte] Accessing associative arrays via variable?<br></font><br></div>
<div>
<div>
<div>For the archives, something that is probably obvious to OOP aware folks, but tripped me up good:<br><br>myObject = new Object();<br><br>myObject.My Property = "rooster";<br><br>debug(myObject.My Property); // gives "rooster"<br><br>debug(myObject["My Property"]); // gives undefined<br><br>No spaces in object properties allowed when using non dot syntax.<br><br><br><br>=====================================<br>
<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</style>
<div id="ecxecxecxecxidOWAReplyText83440" dir="ltr">
<div dir="ltr"><font size="2" color="#000000" face="Arial">b = new Object();<br>b.blah = 'value';</font></div>
<div dir="ltr"><font size="2" color="#000000" face="Arial">v='blah';<br>debug(b[v]); //works for me</font></div></div>
<div dir="ltr"><br>
<hr>
<font size="2" face="Tahoma"><b>From:</b> xerte-bounces@lists.nottingham.ac.uk on behalf of Dave Burnett<br><b>Sent:</b> Sun 27/12/2009 21:49<br><b>To:</b> Xerte list<br><b>Subject:</b> RE: [Xerte] Accessing associative arrays via variable?<br></font><br></div>
<div>help_defs = new Object();<br>helps_defs.Atomic = "Roosters are atomic";<br>debug(helps_defs.Atomic); // gives me "Roosters are atomic"<br>
<div id="ecxecxecxecxecxidOWAReplyText44362" dir="ltr">
<div dir="ltr"><font size="2" color="#000000" face="Arial">myVar = 'Atomic';</font></div>
<div dir="ltr"><font face="Arial">debug(help_defs[myVar]); // gives me u</font>ndefined.<br></div></div><br><br><br>
<hr id="ecxecxecxecxstopSpelling">
Subject: RE: [Xerte] Accessing associative arrays via variable?<br>Date: Sun, 27 Dec 2009 21:23:56 +0000<br>From: Julian.Tenney@nottingham.ac.uk<br>To: xerte@lists.nottingham.ac.uk<br><br>
<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</style>
<div id="ecxecxecxecxecxidOWAReplyText44362" dir="ltr">
<div dir="ltr"><font size="2" color="#000000" face="Arial">myVar = 'Atomic';</font></div>
<div dir="ltr"><font face="Arial">debug(help_defs[myVar]);</font></div></div>
<div dir="ltr"><br>
<hr>
<font size="2" face="Tahoma"><b>From:</b> xerte-bounces@lists.nottingham.ac.uk on behalf of Dave Burnett<br><b>Sent:</b> Sun 27/12/2009 18:05<br><b>To:</b> Xerte list<br><b>Subject:</b> [Xerte] Accessing associative arrays via variable?<br></font><br></div>
<div><br>help_defs = new Object();<br>helps_defs.Atomic = "Roosters are atomic";<br>debug(helps_defs.Atomic); // gives me "Roosters are atomic"<br><br>Can I sub a variable into the place of .Atomic in that last statement?<br><br>Sort of like in AW, to call a value from a property list using a variable for the property name I'd use:<br><br>Trace(my_prop_list[Symbol("a"^some_variable)]) <br>
<hr>
Hotmail: Trusted email with Microsoft’s powerful SPAM protection. <a href="http://clk.atdmt.com/GBL/go/177141664/direct/01/">Sign up now.</a> </div><br>
<hr>
Hotmail: Powerful Free email with security by Microsoft. <a href="http://clk.atdmt.com/GBL/go/171222986/direct/01/">Get it now.</a> </div><br>
<hr>
Hotmail: Trusted email with Microsoft’s powerful SPAM protection. <a href="http://clk.atdmt.com/GBL/go/177141664/direct/01/">Sign up now.</a> </div><br>
<hr>
Hotmail: Free, trusted and rich email service. <a href="http://clk.atdmt.com/GBL/go/171222984/direct/01/">Get it now.</a> </div><br>
<hr>
Hotmail: Trusted email with powerful SPAM protection. <a href="http://clk.atdmt.com/GBL/go/177141665/direct/01/">Sign up now.</a> </div>                                            <br /><hr />Hotmail: Trusted email with Microsoft’s powerful SPAM protection. <a href='http://clk.atdmt.com/GBL/go/177141664/direct/01/' target='_new'>Sign up now.</a></body>
</html>