SPONSORS:






User Tag List

Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Oct 2000
    Location
    South San Francisco, CA, USA
    Posts
    32
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Breaking a While Loop

    Dear Colleagues,
    I'm having difficulty getting a while loop to break correctly. In circumventing an HTMLTable parsing problem, I'm having to construct ways to count HTML elements in Silk and then insert an index into the tag for an element I'm wanting to choose. Luckily, the winclass of these elements (HTMLHeading) is distinct from the rest of the page.

    In the following code I'm trying to increment over all HTMLHeadings from #2 on on the page but break the loop where one string is equal to a string I have retrieved from the database. I would like to output the index of that particular heading as a variable to be inserted into tags later on.

    [ ] STRING sOSName
    [ ] STRING sUIOSName
    [ ] INTEGER iHeading
    [ ] INTEGER iIndex
    [ ] iHeading = 2
    [ ] sOSName = DBGetOSNamefromID (35)
    [ ] print (sOSName)
    [-] while (docGlobSum.HtmlHeading("#{iHeading}").Exists())
    {------}[ ] sUIOSName = docGlobSum.HtmlHeading("#{iHeading}").GetFullCapti on()
    {------}[ ] iIndex = iHeading - 1
    {------}[-] if (sUIOSName == sOSName)
    {------}{-----}[ ] break
    {------}[ ] iHeading = iHeading +1
    [ ] print (iIndex)

    I have been running this loop but it does not stop at the right point and continues until it has run through all headings.

    If this cannot work, is there a way of outputting an element's index from a list of string or list of record? I am trying to make this code as simple as possible.


    [This message has been edited by MichaelH (edited 02-06-2001).]

    [This message has been edited by MichaelH (edited 02-06-2001).]

    [This message has been edited by MichaelH (edited 02-06-2001).]

  2. #2
    Member
    Join Date
    Oct 2000
    Location
    South San Francisco, CA, USA
    Posts
    32
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Breaking a While Loop

    Well, after posting this, I came upon a couple solutions. The while loop listed above works fine..I was not stripping out whitespace that I had pulled out of the database. I also discovered the "ListFind" function in the Silk documentation which returns a listitem's index. So two easy solutions!!!


 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:53 AM.

Copyright BetaSoft Inc.