John,


What you are attempting to do here, assigning a key value into column zero, is 
undocumented and unsupported. In fact, while it does seem to work, it is not 
recommended for use. Currently only assignment into row zero (column naming) is 
supported.



Until I have an opportunity to look into column zero in a future version, I 
would recommend that you use the @FILTER tag to identify a particular row. As 
such:



<@ASSIGN myFocusRow <@FILTER array=request$myArray expr=”#1 = ‘Key1’>>

<@IF @@myFocusRow>

                <@! We found a row with Key1>

<@VAR myFocusRow[1,2]> = Value 1

<@ELSE>

                <@! No row found>

</@IF>



All that said, what is happening is that an unknown key value is interpreted as 
a zero.  Therefore, when you do <@VAR request$myArray[boguskey,2]> what you get 
back is the same as <@VAR request$myArray[0,2]>. Knowing that may help you 
build a test for a bad key, by matching the returned value to the row zero 
value.



I hope that helps for now, and I will look into column zero and other issues 
regarding arrays in 2011 to hopefully make them much more useful.



Robert



PS. Checking to see if an array column contains a value can be done with <@IF 
expr=”<@VAR myArray[*,1]> contains ‘keyValue’”><@! It does></@IF>



From: John Hotaling [mailto:jhotal...@auctionanything.com]
Sent: Tuesday, December 07, 2010 10:20 AM
To: Witango-Talk@witango.com
Subject: Witango-Talk: Array value



Hello:

We're "reading in" a simple key/value list from a table via a stored procedure 
and assigning to an array in Witango.  We then assigned the "0" column to the 
key name in column 1 for easy value lookup - something like



<@FOR START="1" STOP="<@NUMROWS ARRAY='request$MyArray'>" STEP="1">

            <@ASSIGN "request$MyArray[<@CURROW>,0]" <@VAR 
"request$MyArray[<@CURROW>,1]">>

</@FOR>



So,



<@var request$MyArray[Key1,2]> = Value1

<@var request$MyArray[Key2,2]> = Value2

etc



However, if a particular key does NOT exist (which happens in our scenario) in 
the db (say Key3) then <@var request$MyArray[Key3,2]> is returning "value" 
instead of an empty value (as does <@var request$MyArray[somebogusname,2]>).  I 
was expecting an empty value here.  It's been awhile, but maybe this method is 
not optimal for checking the existence of a particular key/value pair in 
addition to accessing the values of various keys.



Thanks in advance for any insight or recommendations.



John



Robert, best of luck with the recent acquisition.  As so many have already 
commented, we also appreciate your diligence and responsiveness on the talk 
list and look forward to seeing where you take the product.  I can't believe we 
started using the product back in 1996 - what a journey.


--
John Hotaling

jhotal...@auctionanything.com

www.AuctionAnything.com

800-866-8009





  _____

To unsubscribe from this list, please send an email to lists...@witango.com 
with "unsubscribe witango-talk" in the body.



----------------------------------------

To unsubscribe from this list, please send an email to lists...@witango.com 
with "unsubscribe witango-talk" in the body.

Reply via email to