Page 1 of 1

Variable Filter

Posted: Sun Jul 20, 2014 4:32 pm
by francof
ciao all,
I'm filtering the content of a variable in this way

Code: Select all

 filter tTempList with  "[1-3]*"
something like: give me all the chunks starting with 1 or 2 or 3

but, if I want, for example, only those that starts with 1 or 2. how can I do without repeating the code like:

Code: Select all

 switch tNumLiv                                        
      case 3                                                      
         filter tTempList with  "[1-3]*"
         --put tNumLiv into tLivInizio
         --put tNumLiv into tLivFine
         break
      case 2                                                      
         filter tTempList with  "[1-2]*"
         --put 1 into tLivInizio
         --put tNumLiv into tLivFine
         break
etc.
......
....
tLivInizio could be the lower value, tLivFine the upper

franco

Re: Variable Filter

Posted: Sun Jul 20, 2014 5:58 pm
by francof
looking for FILTER in the dictionary:
[char-char]
Matches any character whose ASCII value is between the first character and the second character.
the value is between...

so I tried this

Code: Select all

filter tTempList with  "[ ' "& tLivInizio &" ' -  ' "& tLivFine &" ' ]*"
it's work if the character interval is 1-1 (return the lines beginning with 1)
and 1-2 (return the lines beginning with 1 and 2)
but with 1-3 (which should return the lines beginning with 1 and 2 and 3) instead return only the lines beginning with 1 and 3, without the lines 2.

where am I wrong?

Re: Variable Filter

Posted: Sun Jul 20, 2014 7:02 pm
by bn
Hi Franco,

try this:

Code: Select all

put 1 into tLivinizio
   put 3 into tLivFine
   filter tTempList with  "["& tLivInizio & "-" & tLivFine &"]*"
it works for me.

Kind regards
Bernd

Re: Variable Filter

Posted: Sun Jul 20, 2014 8:00 pm
by francof
for me too!
thanks a lot Bernd, you are the number 1 (of the world)
as usual I make confusion with syntax; " ? ' [ < ' &

ciao
franco