Re: [WebDNA] Data Type Bool

This WebDNA talk-list message is from

2009


It keeps the original formatting.
numero = 103159
interpreted = N
texte = --Apple-Mail-25-690537893 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Some handy techniques I use for dealing with boolean values... I define two global text variables in my header include files: [text]true=1=1[/text] [text]false=1=0[/text] Then I use these to set my "boolean" variables within my code: [text]needToDoThis=[true][/text] [text]alreadyDidThis=[true][/text] Then in my IF, SHOWIF and HIDEIF statements, I can use the following: [if [needToDoThis][then] do this [/then][else] don't do this [/else][/if] [showif [needToDoThis]] do this [text]alreadyDidThis=[true][/text] [/showif] [hideif [alreadyDidThis]] gotta do this [/hideif] I don't use these values in my databases, because I prefer to avoid the confusion and need for URL'ing that can arise of sticking equals signs into my simple true / false values. I typically use T or F to represent true and false. I will sometimes do the following when interpreting these values for use in late logic: [text]tInStock=[if "[url][dbInStock][/url]"="T"][then][true][/then] [else][false][/else][/if][/text] Then I can use the following logic: [showif [tInStock]] ... [/showif] Brian Fries BrainScan Software On Aug 6, 2009, at 10:21 AM, Patrick McCormick wrote: > Sorry if I've just confused the heck out of everybody! Godiva is > right. I can remember doing this a while back, but I don't remember > if it worked this way, or if I had to do some setup. > > I experimented and [showif] currently requires an expression that > evaluates to true or false. I will make a feature request to modify > this so that true is anything greater than 0 and false is anything > less than 0. That'd be handy and powerful. > > You can get the same effect if you do a little setup work. I > frequently setup text variables like this: > > [text show=F&multi=T]checkStock=[raw][qty]>0[/ > raw]&inStock=[interpret][checkStock][/interpret][/text] > > From then on I can [showif [instock]] > > I usually put the setup variables in an include file which acts like > a list of definitions of various conditions. It's worth the trouble > because it makes my code more readable. After a while I start to > forget about the include file and believe that [showif [condition]] > just works natively. I done hypnotized myself. > > Pat > > > On Aug 5, 2009, at 12:37 PM, Govinda wrote: > >> I bottom posted, see below: >> >> On Aug 5, 2009, at 11:24 AM, Terry Wilson wrote: >> >>> Then what did you mean when you said: >>> >>>> > Be aware that something like [showif [instock]=1] is >>>> >the same as [showif [instock]] as long as [instock] is >>>> >greater than zero when an item is actually in stock. It >>>> >helps make the code a little bit more readable, too. >> >> there was discussion back around version 4 release (year 2000?) >> (IIRC) about [if] expressions taking advantage of boolean states >> behind the scenes, so that one could use code like what Patrick was >> referring to. In those days I did not pay enough attention about >> that to say more now... but if you wanted to look into the roots >> of this discussion, searching the old archives for what I am >> referring to would be a good start. > --Apple-Mail-25-690537893 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable
Some handy techniques I = use for dealing with boolean values...

I define two = global text variables in my header include = files:

[text]true=3D1=3D1[/text]
[text]false=3D= 1=3D0[/text]

Then I use these to set my = "boolean" variables within my = code:

[text]needToDoThis=3D[true][/text]
[text]alreadyDidThis=3D[true][/text]

Then in my IF, SHOWIF and HIDEIF statements, I can use the = following:

[if = [needToDoThis][then]
= do this
[/then][else]
= don't do this
[/else][/if]

=
[showif [needToDoThis]]
do this
= [text]alreadyDidThis=3D[true][/text]
[/showif]
=
[hideif [alreadyDidThis]]
gotta do = this
[/hideif]


I don't = use these values in my databases, because I prefer to avoid the = confusion and need for URL'ing that can arise of sticking equals signs = into my simple true / false values. I typically use T or F to represent = true and false. I will sometimes do the following when interpreting = these values for use in late = logic:

[text]tInStock=3D[if = "[url][dbInStock][/url]"=3D"T"][then][true][/then][else][false][/else][/if= ][/text]

Then I can use the following = logic:

[showif [tInStock]] ... = [/showif]

Brian = Fries
BrainScan Software


On Aug = 6, 2009, at 10:21 AM, Patrick McCormick wrote:

Sorry if I've just confused the = heck out of everybody! Godiva is right. I can remember doing this a = while back, but I don't remember if it worked this way, or if I had to = do some setup.

I experimented and [showif] = currently requires an expression that evaluates to true or false. =  I will make a feature request to modify this so that true is = anything greater than 0 and false is anything less than 0. That'd be = handy and powerful.

You can get the same effect = if you do a little setup work. I frequently setup text variables = like this:

[text = show=3DF&multi=3DT]checkStock=3D[raw][qty]>0[/raw]&inStock=3D[i= nterpret][checkStock][/interpret][/text]

=46rom = then on I can [showif [instock]]

I usually = put the setup variables in an include file which acts like a list of = definitions of various conditions. It's worth the trouble because = it makes my code more readable. After a while I start to forget about = the include file and believe that [showif [condition]] just works = natively. I done hypnotized = myself.

Pat


On Aug 5, 2009, at 12:37 PM, Govinda wrote:

I bottom posted, see = below:

On Aug 5, 2009, at 11:24 AM, Terry Wilson = wrote:

Then what did you mean when you said:

> Be aware that something like [showif = [instock]=3D1] is 
>the same as [showif [instock]] as long as = [instock] is 
>greater than zero when an item is actually in = stock. It 
>helps make the code a little bit more readable, = too.
<= br>
there was discussion back around version 4 release (year = 2000?)  (IIRC) about [if] expressions taking advantage of boolean = states behind the scenes, so that one could use code like what Patrick = was referring to.  In those days I did not pay enough attention = about that to say more now...  but if you wanted to look into the = roots of this discussion, searching the old archives for what I am = referring to would be a good = start.


= --Apple-Mail-25-690537893-- Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Data Type Bool (John Butler 2009)
  2. Re: [WebDNA] Data Type Bool (Patrick McCormick 2009)
  3. Re: [WebDNA] Data Type Bool (Brian Fries 2009)
  4. Re: [WebDNA] Data Type Bool (Patrick McCormick 2009)
  5. Re: [WebDNA] Data Type Bool (Govinda 2009)
  6. Re: [WebDNA] Data Type Bool ("Terry Wilson" 2009)
  7. Re: [WebDNA] Data Type Bool (Patrick McCormick 2009)
  8. Re: [WebDNA] Data Type Bool ("Ki Song - Knifecenter.com" 2009)
  9. Re: [WebDNA] Data Type Bool ("Terry Wilson" 2009)
  10. Re: [WebDNA] Data Type Bool (Patrick McCormick 2009)
  11. Re: [WebDNA] Data Type Bool (Donovan Brooke 2009)
  12. Re: [WebDNA] Data Type Bool (Marc Thompson 2009)
  13. Re: [WebDNA] Data Type Bool (Patrick McCormick 2009)
  14. Re: [WebDNA] Data Type Bool (Marc Thompson 2009)
  15. Re: [WebDNA] Data Type Bool (Patrick McCormick 2009)
  16. Re: [WebDNA] Data Type Bool (Terry Wilson 2009)
  17. Re: [WebDNA] Data Type Bool ("Ki Song - Knifecenter.com" 2009)
  18. Re: [WebDNA] Data Type Bool (Govinda 2009)
  19. [WebDNA] Data Type Bool ("Ki Song - Knifecenter.com" 2009)
--Apple-Mail-25-690537893 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Some handy techniques I use for dealing with boolean values... I define two global text variables in my header include files: [text]true=1=1[/text] [text]false=1=0[/text] Then I use these to set my "boolean" variables within my code: [text]needToDoThis=[true][/text] [text]alreadyDidThis=[true][/text] Then in my IF, SHOWIF and HIDEIF statements, I can use the following: [if [needToDoThis][then] do this [/then][else] don't do this [/else][/if] [showif [needToDoThis]] do this [text]alreadyDidThis=[true][/text] [/showif] [hideif [alreadyDidThis]] gotta do this [/hideif] I don't use these values in my databases, because I prefer to avoid the confusion and need for URL'ing that can arise of sticking equals signs into my simple true / false values. I typically use T or F to represent true and false. I will sometimes do the following when interpreting these values for use in late logic: [text]tInStock=[if "[url][dbInStock][/url]"="T"][then][true][/then] [else][false][/else][/if][/text] Then I can use the following logic: [showif [tInStock]] ... [/showif] Brian Fries BrainScan Software On Aug 6, 2009, at 10:21 AM, Patrick McCormick wrote: > Sorry if I've just confused the heck out of everybody! Godiva is > right. I can remember doing this a while back, but I don't remember > if it worked this way, or if I had to do some setup. > > I experimented and [showif] currently requires an expression that > evaluates to true or false. I will make a feature request to modify > this so that true is anything greater than 0 and false is anything > less than 0. That'd be handy and powerful. > > You can get the same effect if you do a little setup work. I > frequently setup text variables like this: > > [text show=F&multi=T]checkStock=[raw][qty]>0[/ > raw]&inStock=[interpret][checkStock][/interpret][/text] > > From then on I can [showif [instock]] > > I usually put the setup variables in an include file which acts like > a list of definitions of various conditions. It's worth the trouble > because it makes my code more readable. After a while I start to > forget about the include file and believe that [showif [condition]] > just works natively. I done hypnotized myself. > > Pat > > > On Aug 5, 2009, at 12:37 PM, Govinda wrote: > >> I bottom posted, see below: >> >> On Aug 5, 2009, at 11:24 AM, Terry Wilson wrote: >> >>> Then what did you mean when you said: >>> >>>> > Be aware that something like [showif [instock]=1] is >>>> >the same as [showif [instock]] as long as [instock] is >>>> >greater than zero when an item is actually in stock. It >>>> >helps make the code a little bit more readable, too. >> >> there was discussion back around version 4 release (year 2000?) >> (IIRC) about [if] expressions taking advantage of boolean states >> behind the scenes, so that one could use code like what Patrick was >> referring to. In those days I did not pay enough attention about >> that to say more now... but if you wanted to look into the roots >> of this discussion, searching the old archives for what I am >> referring to would be a good start. > --Apple-Mail-25-690537893 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable
Some handy techniques I = use for dealing with boolean values...

I define two = global text variables in my header include = files:

[text]true=3D1=3D1[/text]
[text]false=3D= 1=3D0[/text]

Then I use these to set my = "boolean" variables within my = code:

[text]needToDoThis=3D[true][/text]
[text]alreadyDidThis=3D[true][/text]

Then in my IF, SHOWIF and HIDEIF statements, I can use the = following:

[if = [needToDoThis][then]
= do this
[/then][else]
= don't do this
[/else][/if]

=
[showif [needToDoThis]]
do this
= [text]alreadyDidThis=3D[true][/text]
[/showif]
=
[hideif [alreadyDidThis]]
gotta do = this
[/hideif]


I don't = use these values in my databases, because I prefer to avoid the = confusion and need for URL'ing that can arise of sticking equals signs = into my simple true / false values. I typically use T or F to represent = true and false. I will sometimes do the following when interpreting = these values for use in late = logic:

[text]tInStock=3D[if = "[url][dbInStock][/url]"=3D"T"][then][true][/then][else][false][/else][/if= ][/text]

Then I can use the following = logic:

[showif [tInStock]] ... = [/showif]

Brian = Fries
BrainScan Software


On Aug = 6, 2009, at 10:21 AM, Patrick McCormick wrote:

Sorry if I've just confused the = heck out of everybody! Godiva is right. I can remember doing this a = while back, but I don't remember if it worked this way, or if I had to = do some setup.

I experimented and [showif] = currently requires an expression that evaluates to true or false. =  I will make a feature request to modify this so that true is = anything greater than 0 and false is anything less than 0. That'd be = handy and powerful.

You can get the same effect = if you do a little setup work. I frequently setup text variables = like this:

[text = show=3DF&multi=3DT]checkStock=3D[raw][qty]>0[/raw]&inStock=3D[i= nterpret][checkStock][/interpret][/text]

=46rom = then on I can [showif [instock]]

I usually = put the setup variables in an include file which acts like a list of = definitions of various conditions. It's worth the trouble because = it makes my code more readable. After a while I start to forget about = the include file and believe that [showif [condition]] just works = natively. I done hypnotized = myself.

Pat


On Aug 5, 2009, at 12:37 PM, Govinda wrote:

I bottom posted, see = below:

On Aug 5, 2009, at 11:24 AM, Terry Wilson = wrote:

Then what did you mean when you said:

> Be aware that something like [showif = [instock]=3D1] is 
>the same as [showif [instock]] as long as = [instock] is 
>greater than zero when an item is actually in = stock. It 
>helps make the code a little bit more readable, = too.
<= br>
there was discussion back around version 4 release (year = 2000?)  (IIRC) about [if] expressions taking advantage of boolean = states behind the scenes, so that one could use code like what Patrick = was referring to.  In those days I did not pay enough attention = about that to say more now...  but if you wanted to look into the = roots of this discussion, searching the old archives for what I am = referring to would be a good = start.


= --Apple-Mail-25-690537893-- Brian Fries

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Submitting ampersands in forms... (1998) user flush db (2002) Showif date range comparison (1999) can we get string variables? (1998) Re:no [search] with NT (1997) Help name our technology! (1997) problems with 2 tags (1997) [Sum] function? (1997) [WebDNA] Friday February 13, 2009 (2009) ThreadMem ignored? (1998) lookups (2000) Sorry WebCat server not running (2001) multiple search commands (1997) What are SMSI's upgrade policies, and how long will they apply? (2003) 2.0 Info (1997) Not really WebCat (1997) Please.. copies of Digest for 7/29 and 7/30? (1997) WebCat2b13MacPlugIn - [showif][search][/showif] (1997) WebCat2 beta 11 - new prefs ... (1997) WebCat2b13 Command Reference Doc error (1997)