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:

Trouble with carts (2000) Popup Calendar Code (2003) formatting dates from a field ... (1997) [sendmail] v. [writefile] (2000) WC2b15 File Corruption (1997) truncating email part II (1997) Ghostly cached webpage (2000) [WebDNA] Processor Maxing out (2010) Nesting format tags (1997) Passing values - never mind (1999) [WebDNA] Tables... (2008) 404 error -- but wc code executes... (2001) The max=0 issue is a bug ... (2000) WCS Newbie question (1997) LOG IN LOG OUT (1997) Using Plug-In while running 1.6.1 (1997) GuestBook example (1997) Webcatalog on MacOs (2000) Showing unopened cart (1997) where to put code (1998)