How to test if a field does not contain anything else than returns or tab ?

2009-02-03 Thread Andre.Bisseret

Bonjour,

I need to test if a given list field in a stack contains some values  
or if it is empty.
Well, by "empty" I mean that the field contains not any word or  
number. But it happens that it may include carriage returns and/or tabs.

In such cases :
field "thisField" is empty
return false.

If there were only carriage returns, I could test if each line of the  
field is empty;

indeed :
line x of fld "thisField" is empty
returns true if the only character in the line is cr
but returns false if there is at least one tab in the line.

I just tried :
if last char of fld "thisField" is empty  ;-))

that seems working well ! but a bit strange and might be not reliable ?

Is there a better trick ?

Thanks for any idea

Best regards from Grenoble
André
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab ?

2009-02-03 Thread Klaus Major

Bonjour Andre,


Bonjour,

I need to test if a given list field in a stack contains some values  
or if it is empty.
Well, by "empty" I mean that the field contains not any word or  
number. But it happens that it may include carriage returns and/or  
tabs.

In such cases :
field "thisField" is empty
return false.

If there were only carriage returns, I could test if each line of  
the field is empty;

indeed :
line x of fld "thisField" is empty
returns true if the only character in the line is cr
but returns false if there is at least one tab in the line.

I just tried :
if last char of fld "thisField" is empty  ;-))

that seems working well ! but a bit strange and might be not  
reliable ?


Is there a better trick ?


I would go like this:
...
put fld "Your field here" into Field_content
replace CR with "" in Field_content
replace TAB with "" in Field_content
## replace anything else that might be necessary

if Field_content = empty then
## do your stuff...
end if
...

Hope that helps.


Thanks for any idea

Best regards from Grenoble
André


Best

Klaus

--
Klaus Major
kl...@major-k.de
http://www.major-k.de

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab ?

2009-02-03 Thread Mark Schonewille

Hi André,

if number of words of fld "This Field" is 0 and (fld "This Field"  
contains cr or fld "This Field" contains tab) then...


--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
Dutch forum: http://runrev.info/rrforum

We are always looking for new projects! Feel free to contact us to  
discuss your custom software project!


On 3 feb 2009, at 15:18, Andre.Bisseret wrote:


Bonjour,

I need to test if a given list field in a stack contains some values  
or if it is empty.
Well, by "empty" I mean that the field contains not any word or  
number. But it happens that it may include carriage returns and/or  
tabs.

In such cases :
field "thisField" is empty
return false.

If there were only carriage returns, I could test if each line of  
the field is empty;

indeed :
line x of fld "thisField" is empty
returns true if the only character in the line is cr
but returns false if there is at least one tab in the line.

I just tried :
if last char of fld "thisField" is empty  ;-))

that seems working well ! but a bit strange and might be not  
reliable ?


Is there a better trick ?

Thanks for any idea

Best regards from Grenoble
André
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab ?

2009-02-03 Thread Andre.Bisseret


Le 3 févr. 09 à 15:22, Klaus Major a écrit :


Bonjour Andre,


Bonjour,

I need to test if a given list field in a stack contains some  
values or if it is empty.
Well, by "empty" I mean that the field contains not any word or  
number. But it happens that it may include carriage returns and/or  
tabs.

In such cases :
field "thisField" is empty
return false.

If there were only carriage returns, I could test if each line of  
the field is empty;

indeed :
line x of fld "thisField" is empty
returns true if the only character in the line is cr
but returns false if there is at least one tab in the line.

I just tried :
if last char of fld "thisField" is empty  ;-))

that seems working well ! but a bit strange and might be not  
reliable ?


Is there a better trick ?


I would go like this:

put fld "Your field here" into Field_content
replace CR with "" in Field_content
replace TAB with "" in Field_content
## replace anything else that might be necessary

if Field_content = empty then
## do your stuff...
end if


Hope that helps.


Ouuups, of course, your are right
I feel a bit ridiculous ;-)

Danke sehr Klaus,

André


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab ?

2009-02-03 Thread Andre.Bisseret


Le 3 févr. 09 à 15:24, Mark Schonewille a écrit :


Hi André,

if number of words of fld "This Field" is 0 and (fld "This Field"  
contains cr or fld "This Field" contains tab) then...


--
Best regards,

Mark Schonewille


Bonjour Mark
Excellent :-)
Same answer as I made to Klaus : I feel ridiculous (so twice).
I seems really brain tired to day ;-)

Anyway, thanks a lot for this idea

Best regards from Grenoble
André




Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
Dutch forum: http://runrev.info/rrforum

We are always looking for new projects! Feel free to contact us to  
discuss your custom software project!


On 3 feb 2009, at 15:18, Andre.Bisseret wrote:


Bonjour,

I need to test if a given list field in a stack contains some  
values or if it is empty.
Well, by "empty" I mean that the field contains not any word or  
number. But it happens that it may include carriage returns and/or  
tabs.

In such cases :
field "thisField" is empty
return false.

If there were only carriage returns, I could test if each line of  
the field is empty;

indeed :
line x of fld "thisField" is empty
returns true if the only character in the line is cr
but returns false if there is at least one tab in the line.

I just tried :
if last char of fld "thisField" is empty  ;-))

that seems working well ! but a bit strange and might be not  
reliable ?


Is there a better trick ?

Thanks for any idea

Best regards from Grenoble
André
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution





___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: How to test if a field does not contain anything else than returns or tab?

2009-02-03 Thread Hugh Senior
This assumes what you need is whether text is in the field...

function isEmpty pFld
  return (num of words of fld pFld = 0)
end isEmpty

HTH

/H


Bonjour,

I need to test if a given list field in a stack contains some values  
or if it is empty.
Well, by "empty" I mean that the field contains not any word or  
number. But it happens that it may include carriage returns and/or tabs.
In such cases :
field "thisField" is empty
return false.

If there were only carriage returns, I could test if each line of the  
field is empty;
indeed :
line x of fld "thisField" is empty
returns true if the only character in the line is cr
but returns false if there is at least one tab in the line.

I just tried :
if last char of fld "thisField" is empty  ;-))

that seems working well ! but a bit strange and might be not reliable ?

Is there a better trick ?

Thanks for any idea

Best regards from Grenoble
Andri
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab ?

2009-02-03 Thread Mark Wieder
Andre.Bisseret-

Yet another variation:

if word 1 to -1 of field "thisField" is empty

-- 
-Mark Wieder
 mwie...@ahsoftware.net

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab ?

2009-02-03 Thread Bob Sneidar
I wonder, isn't there a way to use regular expressions to check for  
white space?


Bob Sneidar
IT Manager
Logos Management
Calvary Chapel CM

On Feb 3, 2009, at 6:18 AM, Andre.Bisseret wrote:


Bonjour,

I need to test if a given list field in a stack contains some values
or if it is empty.
Well, by "empty" I mean that the field contains not any word or
number. But it happens that it may include carriage returns and/or  
tabs.

In such cases :
field "thisField" is empty
return false.

If there were only carriage returns, I could test if each line of the
field is empty;
indeed :
line x of fld "thisField" is empty
returns true if the only character in the line is cr
but returns false if there is at least one tab in the line.

I just tried :
if last char of fld "thisField" is empty  ;-))

that seems working well ! but a bit strange and might be not  
reliable ?


Is there a better trick ?

Thanks for any idea

Best regards from Grenoble
André
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab ?

2009-02-03 Thread DunbarX
This was a big thread on the HC list a few years back. Spaces are odd, in 
that they are not word delimiters. Although they are. One space between two 
word 
is two words, as is ten spaces between them. In HC:

get the number of words of "a   b   c" --two spaces between the chars, 
returns 3

And this

set the itemDelimiter to space

get the number of items of "a   b   c" --returns 1

Space is just a special kind of character, and it is hard to get the white, 
er, space.

Does Rev have more powerful tools?

Craig Newman


**
Great Deals on Dell Laptops. Starting at $499. 
(http://pr.atwola.com/promoclk/10075x1217883258x1201191827/aol?redir=http://ad.
doubleclick.net/clk;211531132;33070124;e)
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab ?

2009-02-03 Thread stephen barncard
I've found that using a non-breaking space instead of a space solves a lot
of problems with parsing text. For instance links clicked in a field with
two words connected with a NBS will act as one word-pair. This is perfect
for headers. Perhaps filtering and searching with a NBS might work better in
some instances.
nbs =  option-spaceascii 202   hex  0xCA

2009/2/3 

> This was a big thread on the HC list a few years back. Spaces are odd, in
> that they are not word delimiters. Although they are. One space between two
> word
> is two words, as is ten spaces between them. In HC:
>
> get the number of words of "a   b   c" --two spaces between the chars,
> returns 3
>
> And this
>
> set the itemDelimiter to space
>
> get the number of items of "a   b   c" --returns 1
>
> Space is just a special kind of character, and it is hard to get the white,
> er, space.
>
> Does Rev have more powerful tools?
>
> Craig Newman
>
>
> **
> Great Deals on Dell Laptops. Starting at $499.
> (
> http://pr.atwola.com/promoclk/10075x1217883258x1201191827/aol?redir=http://ad
> .
> doubleclick.net/clk;211531132;33070124;e)
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



-- 
Stephen Barncard
-
San Francisco
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab ?

2009-02-03 Thread J. Landman Gay

dunb...@aol.com wrote:
This was a big thread on the HC list a few years back. Spaces are odd, in 
that they are not word delimiters. Although they are. One space between two word 
is two words, as is ten spaces between them. In HC:


get the number of words of "a   b   c" --two spaces between the chars, 
returns 3


And this

set the itemDelimiter to space

get the number of items of "a   b   c" --returns 1

Space is just a special kind of character, and it is hard to get the white, 
er, space.


Does Rev have more powerful tools?


In Rev, using space as an itemdelimiter works as you'd expect:

set the itemDel to space
put the number of items in "a b c" -> 3
put the number of items in "a   b c" -> 5

However, the "word" function will still only return the actual number of 
words:


put the number of words in "a b c" -> 3

which is generally what we want.

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab ?

2009-02-03 Thread DunbarX
Jacque:

Score one for modernity. That spaces in Rev can be itemdelimiters is clean 
and logical, and obviates the whole issue.

I have replaced spaces now and then in HC with both visible and invisible 
chars to emulate a space/word delimiter. I was among the camp in the HC thread 
that considered it a demi-bug. And I do see the logic behind having the number 
of words be spaces independent.

Craig Newman

In Rev, using space as an itemdelimiter works as you'd expect:

set the itemDel to space
put the number of items in "a b c" -> 3
put the number of items in "a   b c" -> 5

However, the "word" function will still only return the actual number of
words:

put the number of words in "a     b c" -> 3

which is generally what we want.


**
Great Deals on Dell Laptops. 
Starting at $499. 
(http://pr.atwola.com/promoclk/10075x1217883258x1201191827/aol?redir=http://ad.doubleclick.net/clk;211531132;33070124;e)
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab?

2009-02-04 Thread Andre.Bisseret

Hello
Thanks to all who paid attention to my question
Quite a nice number  of ways (mainly variations around counting the  
number of words)


best regards from Grenoble
André

P.S. Once again I did not receive a couple of messages; those from  
Craig ; I saw they were sent thanks to the answers, and on the archives

One more mystery of e-mail ?


Le 3 févr. 09 à 17:09, Hugh Senior a écrit :


This assumes what you need is whether text is in the field...

function isEmpty pFld
 return (num of words of fld pFld = 0)
end isEmpty

HTH

/H


Bonjour,

I need to test if a given list field in a stack contains some values
or if it is empty.
Well, by "empty" I mean that the field contains not any word or
number. But it happens that it may include carriage returns and/or  
tabs.

In such cases :
field "thisField" is empty
return false.

If there were only carriage returns, I could test if each line of the
field is empty;
indeed :
line x of fld "thisField" is empty
returns true if the only character in the line is cr
but returns false if there is at least one tab in the line.

I just tried :
if last char of fld "thisField" is empty  ;-))

that seems working well ! but a bit strange and might be not  
reliable ?


Is there a better trick ?

Thanks for any idea

Best regards from Grenoble
Andri
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution




___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab?

2009-02-04 Thread Ken Ray



On 2/4/09 8:41 AM, "Andre.Bisseret"  wrote:

> Hello
> Thanks to all who paid attention to my question
> Quite a nice number  of ways (mainly variations around counting the
> number of words)

BTW, just for 100% clairty, none of these "word-based" approaches work if
there is a non-breaking space (  or  ) in the field.  Admittedly,
the possibility of this happening is extremely low, but to be on the safe
side, this is "trim" function I use:

function trim what
  if the platform is "MacOS" then
replace numToChar(202) with " " in what
  else
replace numToChar(160) with " " in what
  end if
  return (word 1 to -1 of what)
end trim

So for testing an empty field, it would be:

  if trim(fld 1) = "" then

HTH,

Ken Ray
Sons of Thunder Software, Inc.
Email: k...@sonsothunder.com
Web Site: http://www.sonsothunder.com/


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab?

2009-02-05 Thread Andre.Bisseret

Very helpful indeed !
Always learning :-) I did not know that a non-breaking space was  
considered as a word !

Like St Thomas, I tried it and … you are right (of course ;-))
Yes, as you say,  it is unlikely (mainly due to the fact that one use  
two keys to type a non-breaking space)

 but sure your function trim is a prudent precaution.

Thanks a lot Ken

André


Le 4 févr. 09 à 19:00, Ken Ray a écrit :





On 2/4/09 8:41 AM, "Andre.Bisseret"  wrote:


Hello
Thanks to all who paid attention to my question
Quite a nice number  of ways (mainly variations around counting the
number of words)


BTW, just for 100% clairty, none of these "word-based" approaches  
work if
there is a non-breaking space (  or  ) in the field.   
Admittedly,
the possibility of this happening is extremely low, but to be on the  
safe

side, this is "trim" function I use:

function trim what
 if the platform is "MacOS" then
   replace numToChar(202) with " " in what
 else
   replace numToChar(160) with " " in what
 end if
 return (word 1 to -1 of what)
end trim

So for testing an empty field, it would be:

 if trim(fld 1) = "" then

HTH,

Ken Ray
Sons of Thunder Software, Inc.
Email: k...@sonsothunder.com
Web Site: http://www.sonsothunder.com/


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution




___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab ?

2009-02-05 Thread viktoras d.

there is:

  if matchText(fld "fText", "\S") is false then
 answer "no text in field"
  end if

This one checks for any symbols that are not "whitespace" of any kind 
(\S is same as [ \t\f\r\n]).


Viktoras

Bob Sneidar wrote:
I wonder, isn't there a way to use regular expressions to check for 
white space?


Bob Sneidar
IT Manager
Logos Management
Calvary Chapel CM

On Feb 3, 2009, at 6:18 AM, Andre.Bisseret wrote:


Bonjour,

I need to test if a given list field in a stack contains some values
or if it is empty.
Well, by "empty" I mean that the field contains not any word or
number. But it happens that it may include carriage returns and/or tabs.
In such cases :
field "thisField" is empty
return false.

If there were only carriage returns, I could test if each line of the
field is empty;
indeed :
line x of fld "thisField" is empty
returns true if the only character in the line is cr
but returns false if there is at least one tab in the line.

I just tried :
if last char of fld "thisField" is empty  ;-))

that seems working well ! but a bit strange and might be not reliable ?

Is there a better trick ?

Thanks for any idea

Best regards from Grenoble
André
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test if a field does not contain anything else than returns or tab ?

2009-02-05 Thread viktoras d.

small correction: \s is same as [ \t\f\r\n], and \S is opposite to \s.

viktoras d. wrote:

there is:

  if matchText(fld "fText", "\S") is false then
 answer "no text in field"
  end if

This one checks for any symbols that are not "whitespace" of any kind 
(\S is same as [ \t\f\r\n]).


Viktoras

Bob Sneidar wrote:
I wonder, isn't there a way to use regular expressions to check for 
white space?


Bob Sneidar
IT Manager
Logos Management
Calvary Chapel CM

On Feb 3, 2009, at 6:18 AM, Andre.Bisseret wrote:


Bonjour,

I need to test if a given list field in a stack contains some values
or if it is empty.
Well, by "empty" I mean that the field contains not any word or
number. But it happens that it may include carriage returns and/or 
tabs.

In such cases :
field "thisField" is empty
return false.

If there were only carriage returns, I could test if each line of the
field is empty;
indeed :
line x of fld "thisField" is empty
returns true if the only character in the line is cr
but returns false if there is at least one tab in the line.

I just tried :
if last char of fld "thisField" is empty  ;-))

that seems working well ! but a bit strange and might be not reliable ?

Is there a better trick ?

Thanks for any idea

Best regards from Grenoble
André
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution