Re: Searching Relational Databases
This WebDNA talk-list message is from 2004
It keeps the original formatting.
numero = 55323
interpreted = N
texte = On 1/8/04 2:13 PM, "Justin Carroll"
wrote:Added a hideif to stop the duplicate entry on the secondary array when thelistwords index = 2 and the value is greater.I cant get to testing this anytime soon.Anyone else want to?> We're using version 4.0.2 rc2 Thanks.Of course in this scenario this could be solved by adding a field to thebusiness.db that contains a updated total employee count that would bemodified by the add/delete in the employee system....BUT, assuming that you cant do that or since this is just an example youcould use the following complex logic.Search on the business.db on your criteria and return a results list thatjust seeds your variables:[Text]Businessrank=[/text][Text]Businesssku=[/text][Text]Busrerank=[/text][search business.db&on something][founditems][text]indexvar=[index][/text][search db=employee.db&eqbusiness_skudatarq=[sku]] [showif [indexvar]=1] [text]businessrank=[SKU]|[numfound]|[/text] [/showif] [showif [indexvar]>1] [text]totalvar=[CountWords Delimiters=|][businessrank][/countwords][/text] [listwords words=[businessrank] Delimiters=|] [showif [index]\2] [showif [numfound]>[word]] [text]busrerank=[sku]|numfound]|[busrerank][/text] [/showif] [showif [index]=[totalvar]] [hideif [numfound]>[word]] [text]busrerank=[busrerank]|[sku]|numfound]|[/text] [/hideif] [/showif] [/showif][/listwords][listwords words=[busrerank] Delimiters=|] [hideif [index]\2][Text]Businesssku=[businesssku]|[word][/text][/listwords][/founditems][/search][listwords words=[businesssku] Delimiters=|][Lookup db=business.db&value=[word]&lookInField=sku&returnField=business_name¬Found=][/listwords]I believe this is fairly solid. It should give you a variable with the skusto the business.db sorted from largest to smallest which you could then useto do the lookups in order.Like I said, this is UNTESTED, but I believe the logic is fairly sound, giveor take a syntax error here or there... I just threw it together to get usstarted.Anyone?Alex J McCombie New World MediaChief Information Officer Box 124888/892.6379 MartVille, NY 13111Alex@NewWorldMedia.com http://OurClients.comInterface Designer WebDNA Programmer Database Designer-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail toWeb Archive of this list is at: http://webdna.smithmicro.com/Alex J McCombie New World MediaChief Information Officer Box 124888/892.6379 MartVille, NY 13111Alex@NewWorldMedia.com http://OurClients.comInterface Designer WebDNA Programmer Database Designer-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
On 1/8/04 2:13 PM, "Justin Carroll" wrote:Added a hideif to stop the duplicate entry on the secondary array when thelistwords index = 2 and the value is greater.I cant get to testing this anytime soon.Anyone else want to?> We're using version 4.0.2 rc2 Thanks.Of course in this scenario this could be solved by adding a field to thebusiness.db that contains a updated total employee count that would bemodified by the add/delete in the employee system....BUT, assuming that you cant do that or since this is just an example youcould use the following complex logic.Search on the business.db on your criteria and return a results list thatjust seeds your variables:[text]Businessrank=[/text][text]Businesssku=[/text][text]Busrerank=[/text][search business.db&on something][founditems][text]indexvar=[index][/text][search db=employee.db&eqbusiness_skudatarq=[sku]] [showif [indexvar]=1] [text]businessrank=[SKU]|[numfound]|[/text] [/showif] [showif [indexvar]>1] [text]totalvar=[CountWords Delimiters=|][businessrank][/countwords][/text] [listwords words=[businessrank] Delimiters=|] [showif [index]\2] [showif [numfound]>[word]] [text]busrerank=[sku]|numfound]|[busrerank][/text] [/showif] [showif [index]=[totalvar]] [hideif [numfound]>[word]] [text]busrerank=[busrerank]|[sku]|numfound]|[/text] [/hideif] [/showif] [/showif][/listwords][listwords words=[busrerank] Delimiters=|] [hideif [index]\2][text]Businesssku=[businesssku]|[word][/text][/listwords][/founditems][/search][listwords words=[businesssku] Delimiters=|][Lookup db=business.db&value=[word]&lookInField=sku&returnField=business_name¬Found=][/listwords]I believe this is fairly solid. It should give you a variable with the skusto the business.db sorted from largest to smallest which you could then useto do the lookups in order.Like I said, this is UNTESTED, but I believe the logic is fairly sound, giveor take a syntax error here or there... I just threw it together to get usstarted.Anyone?Alex J McCombie New World MediaChief Information Officer Box 124888/892.6379 MartVille, NY 13111Alex@NewWorldMedia.com http://OurClients.comInterface Designer WebDNA Programmer Database Designer-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail toWeb Archive of this list is at: http://webdna.smithmicro.com/Alex J McCombie New World MediaChief Information Officer Box 124888/892.6379 MartVille, NY 13111Alex@NewWorldMedia.com http://OurClients.comInterface Designer WebDNA Programmer Database Designer-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Alex McCombie
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:
WebCat2b13 Mac plugin - [sendmail] and checkboxes (1997)
WebCat2b13MacPlugIn - [showif][search][/showif] (1997)
WebDNA vs PHP (2003)
multiple search commands (1997)
Thankyou.tpl (2000)
Snake Bites (1997)
For those of you not on the WebCatalog Beta... (1997)
Re2: frames & carts (1997)
[OT] HTML EMAIL program wanted (1999)
listfiles-looking for slick solution (1997)
Looking up two prices in database? (1997)
Stopping bad HTML propagation ? (1997)
ampersand (1998)
[WebDNA] WebDNA on Ubuntu 12.x (2013)
MacOS X Server problems (2001)
Realtime Top 10 (1999)
Signal Raised Error (Part II) (1997)
Problems with [Search] param - Mac Plugin b15 (1997)
Special characters in field names (1998)
Multiple catalog databases and showcart (1997)