you may be able to use tokenize on your string

1 ;2 ;3 ;4 ;5 ; ; ; ; ;

<@TOKENIZE VALUE="1 ;2 ;3 ;4 ;5 ; ; ;" CHARS=";" NULLTOKENS="false">

NULLTOKENS are when you have a blank cell as a result of the tokenize.
for example if you tokenize "one,two,,four" on comma:
if you have NULLTOKENS = true then the resulting array will have 4 elements with the 3rd being empty if you have NULLTOKENS = false then the resulting array will have 3 elements, skipping the 3rd

you can use the NULLTOKENS to deal with the empty spots, so that filter will not break

Ben

On Dec 30, 2009, at 6:13 AM, WebDude wrote:

Hi Folks,

I have another one I have been working on and I am having a devil of a time trying to get either <@filter> or any type of filtering on text strings to
work correctly. I would appreciate any help.

I have an app that let's you copy and paste text from an XLS file into a <textarea> field. I then take the text and bust it out into columns and rows and populate <input type="text"> fields and then loop through an insert routine. It works well, but I am trying to delete rows that have no values. The reason for no values is from multiple returns from the user without text, or when I present the text back into the <textarea> for editing after the <input type="text"> fields have been edited. I am doing something like
this (using just 1 column for simplicity sake)...

From the <textarea name="text1">...
<@ASSIGN text11 "<@REPLACE STR='<@ARG text1>' FINDSTR='<@CHAR 10>'
REPLACESTR=';'>">
<@ASSIGN text11 "<@REPLACE STR='<@VAR text11>' FINDSTR='<@CHAR 9>'
REPLACESTR=','>">


I the assign the results to an array...


<@ASSIGN NAME="initValue" VALUE="<@VAR text11>">
<@ASSIGN NAME="array1" VALUE="<@ARRAY VALUE=@@initValue CDELIM=','
RDELIM=';'>">
<@ASSIGN column1<@CURROW> "<@VAR NAME='array1[<@CURROW>,1]'>">



The array1 will look something like this when done using <@VAR array1
APrefix='' ASuffix='' RPrefix='' RSuffix=';' CPrefix='' CSuffix=''>...

1 ;2 ;3 ;4 ;5 ;

But sometimes, when a user inputs incorrectly or goes back and edits values,
I may end up with an array that looks like this...

1 ;2 ;3 ;4 ;5 ; ; ; ; ;

What I am trying to do is filter out the empty rows at the end - (; ; ;)

Now when I use <@FILTER> I am totally confused. I can't seem to get it to
work at all. Even a simple filter that I know should work. Examples...

<@FILTER ARRAY="array1" SCOPE="local" EXPR="#1=1">
I get...
An Array was expected as a parameter

OR

<@FILTER ARRAY="<@VAR array1>" SCOPE="local" EXPR="#1=1">
I get...
Error during expression evaluation.
Illegal symbol in statement ["<@__REF name=array1
userref=...@3605a6082eac17134b3b591b>[1,1]=1]

BUT

<@FILTER ARRAY="<@VAR array1>" SCOPE="local" EXPR=""> does not throw an
error, but I am filtering nothing.

I also tried to use any type of string manipluation to get rid of the empty
rows but using anything like
<@CHAR 10>; or just " ;" does not seem to work either.

Any insight would be greatly appreciated.

Thanks!
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf



Ben Johansen
http://www.webspinr.com
[email protected]
Phone: 360-597-3372
Mobile: 360-600-7775




________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to