Page 1 of 1
Array Question...
Posted: Thu Jan 07, 2010 2:20 pm
by topcat888
Hi
I would like to say this:
If the the answer is not in the array (hand built) then write "No Answer" into field "outField"
I know the following is wrong but its what I want to say:
Code: Select all
if the theArray has the answer
then
put theArray[theIndex] into field "outField"
else
put "No Answer" into field "outField"
end if
Could somebody show me the way..?
Thanks
Re: Array Question...
Posted: Thu Jan 07, 2010 3:46 pm
by dunbarx
I don't think you can access the data in them directly, but you can always change them from an array variable into a normal one and then check to see if a string is present:
put yourArray into temp
combine temp using yourDelimiter [and yourOtherDelimiter]
if yourString is in temp then put temp into field "outfield"
Re: Array Question...
Posted: Thu Jan 07, 2010 8:46 pm
by topcat888
ok, thanks.
Re: Array Question...
Posted: Thu Jan 07, 2010 11:51 pm
by sturgis
If this is just a continuation of your other project with the combo boxes I think the following may do what you want.
Code: Select all
if theArray[theIndex] is empty then
put "No Answer." into field "outField"
else
put theArray[theIndex]
end if
topcat888 wrote:Hi
I would like to say this:
If the the answer is not in the array (hand built) then write "No Answer" into field "outField"
I know the following is wrong but its what I want to say:
Code: Select all
if the theArray has the answer
then
put theArray[theIndex] into field "outField"
else
put "No Answer" into field "outField"
end if
Could somebody show me the way..?
Thanks
Re: Array Question...try..
Posted: Fri Jan 08, 2010 4:24 pm
by mario baccheschi
Re: Array Question...
Posted: Fri Jan 08, 2010 8:46 pm
by dunbarx
Topcat, an array cannot be put into a field, or an answer dialog, or anything that displays it, until it has been converted back to a normal variable. Try it: make an array, and then put it into a field. You will see empty. Now combine the array using, say, a return. You will see the data. You can go back and forth, combining and splitting, all day.
Similarly, you cannot (I am sort of sure) determine if a string is in an array without first combining it. But that process is simple, and you will need to do so anyway in order to display its contents.
So, schematically:
put yourArray into temp
combine temp with space
if yourString is among the words of temp then put temp into field "outField"
else put "No Answer" into field "outField"