Re: [WebDNA] help with writefile
This WebDNA talk-list message is from 2012
It keeps the original formatting.
numero = 110059
interpreted = N
texte = No problem. Just glad it helped. :)Sincerely,Kenneth GromeWebDNA Solutionshttp://www.webdnasolutions.comWebDNA Programming and Linux Server Administration> Your solution worked great.> Thank you for showing me how to test for [blank] and how> to use replacefounditems. sfb> > On Dec 19, 2012, at 10:17 AM, WebDNA Solutions
wrote:> > If you want to renumber only those records with a value> > in the NEWSLETTER field this should work:> > > > [search db=story.db[!]> > [/!]&neNEWSLETTERdatarq=[blank][!]> > [/!]&asNEWSLETTERsort=1[!]> > [/!]&NEWSLETTERtype=num][!]> > [/!][replacefounditems][!]> > [/!]NEWSLETTER=[index][!]> > [/!][/replacefounditems][!]> > [/!][/search]> > > > Sincerely,> > Kenneth Grome> > WebDNA Solutions> > http://www.webdnasolutions.com> > WebDNA Programming and Linux Server Administration> > > >> Hi Ken,> >> Thanks for helping me with this.> >> I've worked on it a few more hours, and I'm still> >> having difficulties.> >> > >> I've never used the [replacefounditems] tag before,> >> and I can't control what it's doing. Also, I've tried> >> a number of different numbers in place of the xxx> >> that you've placed in your search command, and I'm> >> not completely sure how that's working either.> >> > >> Each time I run your search command, the> >> [replacefounditems] tag seems to update *all* 43 of> >> the NEWSLETTER fields. I can't seem to exclude it> >> from changing the empty fields or the OFF=TRUE> >> fields.> >> > >> Here's what Im trying to do again:> >> I'm trying to search 43 fields named NEWSLETTER in a> >> > >> .db named story.db I need to ignore the records if the> >> NEWSLETTER = I need to ignore the records if the OFF> >> field = TRUE I need to renumber the NEWSLETTER field> >> from> >> > >> being> >> 1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18> >> > >> to> >> > >> 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17> >> > >> Thank again for any input.> >> sfb> >> > >> On Dec 18, 2012, at 11:41 AM, WebDNA Solutions> > > > wrote:> >>>> You may notice that my .db file has no number 15.> >>>> I need this .db file to have these field numbers to> >>>> be contiguous.> >>> > >>> If you want consecutive numbers in the NEWSLETTER> >>> field of every record except the OFF=TRUE records,> >>> try this:> >>> > >>> [search db=story.db[!]> >>> [/!]&neSTORYNUMBERdatarq=xxx[!]> >>> [/!]&neOFFdatarq=TRUE[!]> >>> [/!]&asNEWSLETTERsort=1[!]> >>> [/!]&NEWSLETTERtype=num][!]> >>> [/!][replacefounditems][!]> >>> [/!]NEWSLETTER=[index][!]> >>> [/!][/replacefounditems][!]> >>> [/!][/search]> >>> > >>> Or if you want to include the OFF=TRUE records simply> >>> remove the third line of code above.> >>> > >>> Sincerely,> >>> Kenneth Grome> >>> WebDNA Solutions> >>> http://www.webdnasolutions.com> >>> WebDNA Programming and Linux Server Administration> >>> > >>>> Therefore, my next step was to add a> >>>> comparison between the number written to the file,> >>>> and the current number found. If they are found to> >>>> be more than one number apart, I would then execute> >>>> another step to replace the variable number.> >>>> > >>>> Unless you know of another way to reorder integer> >>>> numbers in a .db field to be in order, without> >>>> skipping any.....> >>>> > >>>> Thanks,> >>>> sfb> >>>> > >>>> On Dec 18, 2012, at 9:59 AM, WebDNA Solutions> >>> > >>> wrote:> >>>>> What are you actually trying to accomplish? You're> >>>>> repetitively writing then deleting temporary.txt> >>>>> files. Why?> >>>>> > >>>>> Sincerely,> >>>>> Kenneth Grome> >>>>> WebDNA Solutions> >>>>> http://www.webdnasolutions.com> >>>>> WebDNA Programming and Linux Server Administration> >>>>> > >>>>>> Hi All,> >>>>>> Here is my code: (I knew that you would ask)> >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> [writefile temporary.txt]0[/writefile]> >>>>>> > >>>>>> > >>>>>> [search> >>>>>> > >>>>>> db=story.db&geSTORYNUMBERdata=1&asNEWSLETTERsort=1> >>>>>> &N EW SL ETTERtype=num] [founditems]> >>>>>> > >>>>>> [hideif [OFF]=True]> >>>>>> > >>>>>> > >>>>>> > >>>>>> [showif [NEWSLETTER]>0]> >>>>>> > >>>>>> [include temporary.txt],> >>>>>> [deletefile temporary.txt]> >>>>>> [writefile temporary.txt]> >>>>> > >>>>> [NEWSLETTER][/writefile]> >>>>> > >>>>>> [NEWSLETTER]> >>>>>> > >>>>>> [/showif]> >>>>>> | > >>>>>> > >>>>>>
> >>>>>> > >>>>>> [/hideif]> >>>>>> > >>>>>> [/founditems]> >>>>>> > >>>>>> [/search]> >>>>>> > >>>>>>
> >>>>>> > >>>>>>