Re: Associative lookup style?

This WebDNA talk-list message is from

1997


It keeps the original formatting.
numero = 10788
interpreted = N
texte = OK, this is going to be a long answer, and it won't be complete but it will get you started. I'm sorry it's a bit complex, but then so is your shipping model. I'm just happy to say it's possible, rather than saying too bad.>Now, I want to summate that field and use the resultant sum as an >associative lookup in our countries database to determine the [shipCost] >total. The countries database has the following fields: >Country Group_Code half_lb one_lb two_lb three_lb four_lb five_lb addl_lb>1) Would I get the total weight via [unitShipCostsumm=T] ?No. The summary feature finds all the unique values during a search, so it wouldn't apply here. Here's how you get the total weight:First, set the unitShipCost field in your product database to 0, because you don't want that interfering with subsequent calculations. Second, use one of the extra line item text fields (such as textA) to store the product's weight, something like $Add?sku=[sku]&textA=[weight]. On your shopping cart page (the one previous to the invoice page) put the following:2) Assuming 1) if that total was 3.4 lbs. I would want to lookup under >four_lb field for whatever country the shipping address was. How do you >do an indexing type of lookup on a database field given one of the fields >(country) is used as a lookup? e.g.Cool Tip Alert: database field names can be numbers! So we'll take whatever the total weight is and look in the shipping database field 2 or 4 or whatever [totalWeight] is.------ Formulas.db ------ shipCost [lookup db=countries.db&lookInField=country&value=[shipToCountry]&returnField=[totalWeight]]So change your fieldnames in countries.db from one_lb to 1 and two_lb to 2, etc. That way you can use a calculation to tell you which field to look in.I know this doesn't catch your edge conditions, such as > 5 pounds, etc., but it's a start. You can either fill out your database with more weights, or you can throw some [showif]s into the formula to catch special cases.Grant Hulbert, V.P. Engineering | ===== Tools for WebWarriors ===== Pacific Coast Software | WebCatalog Pro, WebCommerce Solution 11770 Bernardo Plaza Court, #462 | SiteEdit Pro, SiteCheck, PhotoMaster San Diego, CA 92128 | SiteGuard 619/675-1106 Fax: 619/675-0372 | http://www.smithmicro.com Associated Messages, from the most recent to the oldest:

    
  1. Re: Associative lookup style? + bit more (Grant Hulbert 1997)
  2. Re: Associative lookup style? + bit more (w curt eggemeyer 1997)
  3. Re: Associative lookup style? + bit more (Grant Hulbert 1997)
  4. Re: WebCat editing, SiteGuard WAS:SiteAssociative lookup style? (Grant Hulbert 1997)
  5. Re: Associative lookup style? + bit more (w curt eggemeyer 1997)
  6. WebCat editing, SiteGuard WAS:SiteAssociative lookup style? (Sven U. Grenander 1997)
  7. Re: Associative lookup style? (Grant Hulbert 1997)
  8. Associative lookup style? (w curt eggemeyer 1997)
OK, this is going to be a long answer, and it won't be complete but it will get you started. I'm sorry it's a bit complex, but then so is your shipping model. I'm just happy to say it's possible, rather than saying too bad.>Now, I want to summate that field and use the resultant sum as an >associative lookup in our countries database to determine the [shipCost] >total. The countries database has the following fields: >Country Group_Code half_lb one_lb two_lb three_lb four_lb five_lb addl_lb>1) Would I get the total weight via [unitShipCostsumm=T] ?No. The summary feature finds all the unique values during a search, so it wouldn't apply here. Here's how you get the total weight:First, set the unitShipCost field in your product database to 0, because you don't want that interfering with subsequent calculations. Second, use one of the extra line item text fields (such as textA) to store the product's weight, something like $Add?sku=[sku]&textA=[weight]. On your shopping cart page (the one previous to the invoice page) put the following:[math]ciel([lineitems][quantity]*[textA]+[/lineItems]0)[/math]This loops through all the line items, adding each of their weights, and rounding up the results to the next higher integer. It stores the answer in a form variable called totalWeight, which we'll use in your formulas.db later.>2) Assuming 1) if that total was 3.4 lbs. I would want to lookup under >four_lb field for whatever country the shipping address was. How do you >do an indexing type of lookup on a database field given one of the fields >(country) is used as a lookup? e.g.Cool Tip Alert: database field names can be numbers! So we'll take whatever the total weight is and look in the shipping database field 2 or 4 or whatever [totalWeight] is.------ formulas.db ------ shipCost [lookup db=countries.db&lookInField=country&value=[shipToCountry]&returnField=[totalWeight]]So change your fieldnames in countries.db from one_lb to 1 and two_lb to 2, etc. That way you can use a calculation to tell you which field to look in.I know this doesn't catch your edge conditions, such as > 5 pounds, etc., but it's a start. You can either fill out your database with more weights, or you can throw some [showif]s into the formula to catch special cases.Grant Hulbert, V.P. Engineering | ===== Tools for WebWarriors ===== Pacific Coast Software | WebCatalog Pro, WebCommerce Solution 11770 Bernardo Plaza Court, #462 | SiteEdit Pro, SiteCheck, PhotoMaster San Diego, CA 92128 | SiteGuard 619/675-1106 Fax: 619/675-0372 | http://www.smithmicro.com Grant Hulbert

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] Anyone using Ubuntu 17.04 yet? (2017) Unable to view next 101-200 (1997) credit card question (simple) (2001) WebCat Admin access w/ClearlyHome p.i. (1997) Customizing WebDelivery.html (1998) FTP via Shell Question (2005) [WebDNA] Froala Editor working with WebDNA (2016) Where's Cart Created ? (1997) Grouping fields help (2004) Webcat no longer supported? (2006) second question of the day... (2004) Bad suffix error (1997) Shipping based in distance and weight (1999) Bug Report, maybe (1997) Another question (1997) dollar $ signs in database (2000) FoundItems Question (1998) Getting Emailer to send mail (1997) Was it something I said??? (1998) SKU lookup (1997)