Re: Somebody to open my eyes!!!

This WebDNA talk-list message is from

2004


It keeps the original formatting.
numero = 57414
interpreted = N
texte = Lawrence - I see a few problems with your code... * [text][math]fin=[debut]+[NBphoto][/math][/text] This code, while it will work, is not the most efficient way to get your results. The [math]fin=... part will set a MATH variable named "fin", which is fine. The [text] context is doing nothing here except to hide the returned value of the [math] context. You can get the same result by adding a "show=F" parameter to your math tag - [math show=F]fin=...[/math] - and skipping the [text] context altogether. Alternatively, (and this is what I do generally) you can modify the context set to set a TEXT variable instead of a MATH variable like this - [text]fin=[math][debut]+[NBphoto][/math][/text]. I prefer to make all my variables TEXT rather than MATH variables to avoid MATH variable limitations on the variable name length and the number of math variables that can be defined (I think its limited to 99), and also to reduce the chance of setting two variables - a MATH variable and a TEXT variable - with the same name (name space conflicts are one of the most common programming errors when using WebDNA). * [Search db=ref_images.db&geSKUdata=[debut]&SKUtype=num&asSKUsort=1] This will find all records with the SKU greater than or equal to [debut]. I'm not sure what you are intending, but this doesn't look right in you loop. Since your search is not dependent on the index of your loop or any other changing value, each time through the loop the search will be finding and updating the same set of records. * [ReplaceFoundItems]ref_origine=[index][/ReplaceFoundItems] The [replacefounditems] context generates its own value for [index] - the index value of the record being replaced within the set of found records. It looks like you were probably wanting the index of the [loop] context that encloses your search. To do this, you need to set a variable to the value of index before your [search] tag, then use that variable in your [replacefounditems] context, something like this: [loop ...] [text]loopIndex=[index][/text] [search ...] [replacefounditems]ref_origine=[loopIndex][/replacefounditems] [/search] [/loop] I hope this helps... - brian On Apr 20, 2004, at 4:47 AM, Lawrence wrote: > Hello!!! > > I have an easy problem!! > I'm sure I have the answer in front of my eyes!!!! > > I have files witch already have an ID. > I need too rename the files too get them in a new DB. > I also need too keep the Original ID in the new DB > > The files I have are all in different folders but there is never the > same > quantity off files! > I wish too append in the db the new SKU of the files and the old ID at > the > same time!!!! > > I tried > Debut= the first Number > Fin= The last > > [text][math]fin=[debut]+[NBphoto][/math][/text] > [loop start=[debut]&end=[FIN]&advance=1] > [text]SKU=[index][/text] > [append db=ref_images.db]SKU=[SKU][/append] > [/loop] > > [text][math]fin_origine=[debut_origine]+[NBphoto][/math][/text] > [loop start=[debut_origine]&end=[FIN_origine]&advance=1] > [Search > db=ref_images.db&geSKUdata=[debut]&SKUtype=num&asSKUsort=1][ReplaceFoun > dItem > s]ref_origine=[index][/ReplaceFoundItems][/Search] > [/loop] -- Brian Fries, BrainScan Software -- http://www.brainscansoftware.com -- ------------------------------------------------------------- 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:

    
  1. Re: Somebody to open my eyes!!! ( Brian Fries 2004)
  2. Somebody to open my eyes!!! ( Lawrence 2004)
Lawrence - I see a few problems with your code... * [text][math]fin=[debut]+[NBphoto][/math][/text] This code, while it will work, is not the most efficient way to get your results. The [math]fin=... part will set a MATH variable named "fin", which is fine. The [text] context is doing nothing here except to hide the returned value of the [math] context. You can get the same result by adding a "show=F" parameter to your math tag - [math show=F]fin=...[/math] - and skipping the [text] context altogether. Alternatively, (and this is what I do generally) you can modify the context set to set a TEXT variable instead of a MATH variable like this - [text]fin=[math][debut]+[NBphoto][/math][/text]. I prefer to make all my variables TEXT rather than MATH variables to avoid MATH variable limitations on the variable name length and the number of math variables that can be defined (I think its limited to 99), and also to reduce the chance of setting two variables - a MATH variable and a TEXT variable - with the same name (name space conflicts are one of the most common programming errors when using WebDNA). * [Search db=ref_images.db&geSKUdata=[debut]&SKUtype=num&asSKUsort=1] This will find all records with the SKU greater than or equal to [debut]. I'm not sure what you are intending, but this doesn't look right in you loop. Since your search is not dependent on the index of your loop or any other changing value, each time through the loop the search will be finding and updating the same set of records. * [replacefounditems]ref_origine=[index][/ReplaceFoundItems] The [replacefounditems] context generates its own value for [index] - the index value of the record being replaced within the set of found records. It looks like you were probably wanting the index of the [loop] context that encloses your search. To do this, you need to set a variable to the value of index before your [search] tag, then use that variable in your [replacefounditems] context, something like this: [loop ...] [text]loopIndex=[index][/text] [search ...] [replacefounditems]ref_origine=[loopIndex][/replacefounditems] [/search] [/loop] I hope this helps... - brian On Apr 20, 2004, at 4:47 AM, Lawrence wrote: > Hello!!! > > I have an easy problem!! > I'm sure I have the answer in front of my eyes!!!! > > I have files witch already have an ID. > I need too rename the files too get them in a new DB. > I also need too keep the Original ID in the new DB > > The files I have are all in different folders but there is never the > same > quantity off files! > I wish too append in the db the new SKU of the files and the old ID at > the > same time!!!! > > I tried > Debut= the first Number > Fin= The last > > [text][math]fin=[debut]+[NBphoto][/math][/text] > [loop start=[debut]&end=[FIN]&advance=1] > [text]SKU=[index][/text] > [append db=ref_images.db]SKU=[SKU][/append] > [/loop] > > [text][math]fin_origine=[debut_origine]+[NBphoto][/math][/text] > [loop start=[debut_origine]&end=[FIN_origine]&advance=1] > [Search > db=ref_images.db&geSKUdata=[debut]&SKUtype=num&asSKUsort=1][ReplaceFoun > dItem > s]ref_origine=[index][/ReplaceFoundItems][/Search] > [/loop] -- Brian Fries, BrainScan Software -- http://www.brainscansoftware.com -- ------------------------------------------------------------- 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/ 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:

Dubble Sku's in a Database (1999) Multiple fields on 1 input (1997) Emailer (1997) The Guru and the Cyclops (1998) database freeze (1997) A few questions. . . (1997) Redirect frame targets (1998) WebCatalog NT beta 18 problem (1997) [WebDNA] [ot] Snow Leopard Server - Mac Mini (2010) PROBLEM (1997) [Sum] function? (1997) WebCat2 - Getting to the browser's username/password data (1997) YACBQ.....(Yet another checkbox question) (2000) NT considerations (1997) RE: Signal Raised (1997) Emailer (1997) New index for docs (1997) [Reload mydata.db] (1998) Re:Emailer and encryption (1997) MacOS9 plugin 4.0.2b5 template security error (2000)