Re: ANother SHOWIF problem
This WebDNA talk-list message is from 1997
It keeps the original formatting.
numero = 13454
interpreted = N
texte = >In my database, I have divided the on sale date of an item into month>(1-12), day (1-31), and year (01-99) fields (for a number of reasons).What's the name of your on sale date field?You named it date, didn't you?That's the problem ... :)>For some reason, the following code (which is inside a [SEARCH] context)>*always* displays the on sale date.>>[SHOWIF [MATH][DATE][/MATH]<[MATH]{[MTH]/[DAY]/[YR]}[/MATH]]
On sale>[MTH]/[DAY]/[YR][/SHOWIF]You didn't mention it, but this WebDNA is also located inside a[founditems] context, isn't it? Here's what you're running into ...When WebCat sees a [date] tag inside a [founditems] context, it looksfor a field in the database named date, and it uses that valueinstead of the server date.That's why it is never a good idea to use date as a field name,because eventually you will want to do something exactly like whatyou're trying to do, and then you will run into the problem you'reseeing now - WebCat is using the 'date' value stored in your databaseinstead of the server's date.All you have to do is change the name of your 'date' field tosomething else - like SaleDate for example. Then when WebCat sees[date] in your WebDNA, it will NOT be able to find a field in yourdatabase named date, so it will use the date value from your serverinstead ... :)Sincerely, Ken GromeWebDNA Solutionshttp://www.hui.net/dna/webdna.html
Associated Messages, from the most recent to the oldest:
>In my database, I have divided the on sale date of an item into month>(1-12), day (1-31), and year (01-99) fields (for a number of reasons).What's the name of your on sale date field?You named it date, didn't you?That's the problem ... :)>For some reason, the following code (which is inside a
[search] context)>*always* displays the on sale date.>>[SHOWIF
[math][date][/MATH]<
[math]{[MTH]/[DAY]/[YR]}[/MATH]]
On sale>[MTH]/[DAY]/[YR][/SHOWIF]You didn't mention it, but this WebDNA is also located inside a
[founditems] context, isn't it? Here's what you're running into ...When WebCat sees a
[date] tag inside a
[founditems] context, it looksfor a field in the database named date, and it uses that valueinstead of the server date.That's why it is never a good idea to use date as a field name,because eventually you will want to do something exactly like whatyou're trying to do, and then you will run into the problem you'reseeing now - WebCat is using the 'date' value stored in your databaseinstead of the server's date.All you have to do is change the name of your 'date' field tosomething else - like SaleDate for example. Then when WebCat sees
[date] in your WebDNA, it will NOT be able to find a field in yourdatabase named date, so it will use the date value from your serverinstead ... :)Sincerely, Ken GromeWebDNA Solutionshttp://www.hui.net/dna/webdna.html
Kenneth Grome
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:
WebDNA Solutions ... sorry! (1997)
emailer (1997)
did I miss anything (1997)
Date Formats (1997)
include bug????? (1997)
WebCat2: Items xx to xx shown, etc. (1997)
WebCatalog can't find database (1997)
How to include weather (2000)
Cart questions (1997)
Preventing code execution (2003)
[WebDNA] autoresponder email addresses (2012)
Sort Order on a page search (1997)
[WebDNA] High-profile WebDNA sites? (2008)
[OT] Am I an Idiot? (2004)
syntax question, not in online refernce (1997)
help with writefile (1998)
flushdatabases (1997)
(1997)
carriage returns in data (1997)
YACBQ.....(Yet another checkbox question) (2000)