Re: nested ListWords?

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 50568
interpreted = N
texte = I looked at [getChars], but it would require that I first determine the indices of the delimiters, which seemed like more steps than my workaround. I also tried [Middle], but that only works for the middle substring in this case and it would require using different characters for each delimiter, which makes it harder to read.Still hoping for [split]... Dave Hurley Biology Department University of WashingtonOn Wednesday, May 21, 2003, at 12:17 PM, Laurent Bache wrote:> Do you have tested with [getchars] ?? > > >> I have a list of information that contains elements composed of three >> sets of characters separated by -. I want to extract the three sets >> of substrings from each element in turn. I thought I might be able to >> use a ListWords context nested inside another, but [word] in the >> inner context returns the [word] from the outer one. I can get around >> this by using ListPath after converting - to /, but this seems >> inelegant. Does someone have a better solution or other insights? >> >> Is it worth requesting a split feature, as in [split >> string=[some-bits-here-and-there]&delimiter=-&index=4]? >> >> Code that doesn't work (I tried Switch & Case statements, too): >> >> [text]lst=A1-9-dh1,A2-9-dh2,A3-9-dh3[/text] >> >> [listwords words=[lst]&delimiters=,] >> [text]thisword=[word][/text]
>> [listwords words=[thisword]&delimiter=-] >> [if ([index]=1)] >> [then] >> [text]well=[thisword][/text] >> well=[well]
>> [/then] >> [/if] >> [if ([index]=2)] >> [then] >> [text]orderNum=[word][/text] >> orderNum = [orderNum]
>> [/then] >> [/if] >> [if ([index]=3)] >> [then] >> [text]sampleName=[word][/text] >> SN = [sampleName]

>> [/then] >> [/if] >> [/listWords] >> [/listWords] >> >> Workaround that does work but is kludgey: >> >> [text]lst=A1-9-dh1,A2-9-dh2,A3-9-dh3[/text] >> [text]lstC=[Grep search=(-)&replace=/][lst][/Grep][/text] >> [listwords words=[lstC]&delimiters=,] >> [text]s=[word][/text] >> s = [word] >> [listPath path=[s]]
>> [Switch value=[index]] >> [case value=1] >> [text]well=[name][/text] >> [/case] >> [case value=2] >> [text]orderNum=[name][/text] >> [/case] >> [case value=3] >> [text]sampleName=[name][/text] >> [/case] >> [/switch] >> [/listPath] >> [/listWords] >> >> Thanks again. >> >> Dave Hurley >> Biology Department >> University of Washington >> >> ------------------------------------------------------------- >> 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/ >> >> > > > ------------------------------------------------------------- > 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/ > ------------------------------------------------------------- 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: nested ListWords? (marc@kaiwi.com (Marc Kaiwi) 2003)
  2. Re: nested ListWords? (Rob Marquardt 2003)
  3. Re: nested ListWords? (Dave Hurley 2003)
  4. Re: nested ListWords? (marc@kaiwi.com (Marc Kaiwi) 2003)
  5. Re: nested ListWords? (Rob Marquardt 2003)
  6. Re: nested ListWords? (Dave Hurley 2003)
  7. Re: nested ListWords? (Laurent Bache 2003)
  8. nested ListWords? (Dave Hurley 2003)
I looked at [getchars], but it would require that I first determine the indices of the delimiters, which seemed like more steps than my workaround. I also tried [middle], but that only works for the middle substring in this case and it would require using different characters for each delimiter, which makes it harder to read.Still hoping for [split]... Dave Hurley Biology Department University of WashingtonOn Wednesday, May 21, 2003, at 12:17 PM, Laurent Bache wrote:> Do you have tested with [getchars] ?? > > >> I have a list of information that contains elements composed of three >> sets of characters separated by -. I want to extract the three sets >> of substrings from each element in turn. I thought I might be able to >> use a ListWords context nested inside another, but [word] in the >> inner context returns the [word] from the outer one. I can get around >> this by using ListPath after converting - to /, but this seems >> inelegant. Does someone have a better solution or other insights? >> >> Is it worth requesting a split feature, as in [split >> string=[some-bits-here-and-there]&delimiter=-&index=4]? >> >> Code that doesn't work (I tried Switch & Case statements, too): >> >> [text]lst=A1-9-dh1,A2-9-dh2,A3-9-dh3[/text] >> >> [listwords words=[lst]&delimiters=,] >> [text]thisword=[word][/text]
>> [listwords words=[thisword]&delimiter=-] >> [if ([index]=1)] >> [then] >> [text]well=[thisword][/text] >> well=[well]
>> [/then] >> [/if] >> [if ([index]=2)] >> [then] >> [text]orderNum=[word][/text] >> orderNum = [orderNum]
>> [/then] >> [/if] >> [if ([index]=3)] >> [then] >> [text]sampleName=[word][/text] >> SN = [sampleName]

>> [/then] >> [/if] >> [/listWords] >> [/listWords] >> >> Workaround that does work but is kludgey: >> >> [text]lst=A1-9-dh1,A2-9-dh2,A3-9-dh3[/text] >> [text]lstC=[Grep search=(-)&replace=/][lst][/Grep][/text] >> [listwords words=[lstC]&delimiters=,] >> [text]s=[word][/text] >> s = [word] >> [listPath path=[s]]
>> [Switch value=[index]] >> [case value=1] >> [text]well=[name][/text] >> [/case] >> [case value=2] >> [text]orderNum=[name][/text] >> [/case] >> [case value=3] >> [text]sampleName=[name][/text] >> [/case] >> [/switch] >> [/listPath] >> [/listWords] >> >> Thanks again. >> >> Dave Hurley >> Biology Department >> University of Washington >> >> ------------------------------------------------------------- >> 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/ >> >> > > > ------------------------------------------------------------- > 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/ > ------------------------------------------------------------- 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/ Dave Hurley

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:

Plugin or CGI or both (1997) Dark Horse Comics success story (1997) WebCat2 beta 11 - new prefs ... (1997) Security for malls with different webmasters (1998) Saving Text Areas with Orders (1997) SmithMicro Help! -- Can't access WebCatalog Admin! (2001) [input] [/input] (1997) Where's Cart Created ? (1997) [listfiles] anomaly (2003) pop up menu's (1998) Help! WebCat2 bug (Ben's input) (1997) OT (maybe) Setting up local (non internet) test computers (2000) Re:no [search] with NT (1997) WC --> printer (1998) [Sum] function? (1997) PCS Frames (1997) [WebDNA] Encode cookies ONLY via "method=Base64" (2008) Problems getting parameters passed into email. (1997) Assigning carts (1998) NewCart+Search with one click ? (1997)