3 Replies Latest reply on Oct 16, 2012 10:55 AM by MarcMcCall

    Help cleaning up a text field retrieved from a web page

    MarcMcCall

      Title

      Help cleaning up a text field retrieved from a web page

      Post

           Hey guys.

            

           I'm trying to automate a process that updates the count of web service functions and then lets me know which ones are new.  I have a script which retireves the html code of the page containing the functions and enters it into a text field.  the only texx I want to remain in the field is below in red.

           <a href="evolution.asmx?op=Add100ContractItems">

           The surounding text will always be the same  <a href="evolution.asmx?op= ########">

      I would like the remainer of the text it extracts separated by a cariage return to create a list.

      This list is then checked by another field with the last retieved functions and another calculation which only leaves me the new functions.  This is then carried over into a dialog box that displays the new functions names at the end of a start up script.  I have everything working except for cleaning up the html code to create the new list.

            

      Thanks for any assistance

      Marc

        • 1. Re: Help cleaning up a text field retrieved from a web page
          philmodjunk

          would like the remainer of the text it extracts separated by a cariage return to create a list.

          So you have multiple instances of the sample text in your field?

          I'd try this function to see if it cleans things up acceptably:

          Substitute ( YourTextFieldHere ; ["<a href=\"evolution.asmx?op=" ; "" ] ; ["\'>" ; "" ] )

          • 2. Re: Help cleaning up a text field retrieved from a web page
            MarcMcCall

                 No because it ha the rest of the html code for the page.  I thought it would be easier using those to search to the right and left of what I want to keep then trying to figure out what to get rid of.  Here is a look at some more of the html code.

                  

                  

                 <html>
                     <head><link rel="alternate" type="text/xml" href="/evolution.asmx?disco" />
                     <style type="text/css">
                 BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; }
                 #content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; }
                 A:link { color: #336699; font-weight: bold; text-decoration: underline; }
                 A:visited { color: #6699cc; font-weight: bold; text-decoration: underline; }
                 A:active { color: #336699; font-weight: bold; text-decoration: underline; }
                 A:hover { color: cc3300; font-weight: bold; text-decoration: underline; }
                 P { color: #000000; margin-top: 0px; margin-bottom: 12px; font-family: Verdana; }
                 pre { background-color: #e5e5cc; padding: 5px; font-family: Courier New; font-size: x-small; margin-top: -5px; border: 1px #f0f0e0 solid; }
                 td { color: #000000; font-family: Verdana; font-size: .7em; }
                 h2 { font-size: 1.5em; font-weight: bold; margin-top: 25px; margin-bottom: 10px; border-top: 1px solid #003366; margin-left: -15px; color: #003366; }
                 h3 { font-size: 1.1em; color: #000000; margin-left: -15px; margin-top: 10px; margin-bottom: 10px; }
                 ul { margin-top: 10px; margin-left: 20px; }
                 ol { margin-top: 10px; margin-left: 20px; }
                 li { margin-top: 10px; color: #000000; }
                 font.value { color: darkblue; font: bold; }
                 font.key { color: darkgreen; font: bold; }
                 font.error { color: darkred; font: bold; }
                 .heading1 { color: #ffffff; font-family: Tahoma; font-size: 26px; font-weight: normal; background-color: #003366; margin-top: 0px; margin-bottom: 0px; margin-left: -30px; padding-top: 10px; padding-bottom: 3px; padding-left: 15px; width: 105%; }
                 .button { background-color: #dcdcdc; font-family: Verdana; font-size: 1em; border-top: #cccccc 1px solid; border-bottom: #666666 1px solid; border-left: #cccccc 1px solid; border-right: #666666 1px solid; }
                 .frmheader { color: #000000; background: #dcdcdc; font-family: Verdana; font-size: .7em; font-weight: normal; border-bottom: 1px solid #dcdcdc; padding-top: 2px; padding-bottom: 2px; }
                 .frmtext { font-family: Verdana; font-size: .7em; margin-top: 8px; margin-bottom: 0px; margin-left: 32px; }
                 .frmInput { font-family: Verdana; font-size: 1em; }
                 .intro { margin-left: -15px; }
                     </style>
                     <title>
                 Evolution Web Service
                 </title></head>
                   <body>
                     <div id="content">
                       <p class="heading1">Evolution</p><br>
                       <span>
                           <p class="intro">Evolution Ecommerce Order Web Service</p>
                       </span>
                       <span>
                           <p class="intro">The following operations are supported.  For a formal definition, please review the <a href="evolution.asmx?WSDL">Service Description</a>. </p>
                               <ul>
                               <li>
                                 <a href="evolution.asmx?op=Add100ContractItems">Add100ContractItems</a>
                                 <span>
                                   <br>Add 100 Contract Items.
                                 </span>
                               </li>
                       <p>
                                    <li>
                                      <a href="evolution.asmx?op=Add10ContractItems">Add10ContractItems</a>
                                      <span>
                                        <br>Add 10 Contract Items.
                                      </span>
                                    </li>

                  

            • 3. Re: Help cleaning up a text field retrieved from a web page
              MarcMcCall

                   Well after digging and digging and about 10 tries I found a function on briandunning.com that works  

                   ParseAllBetween ( WebServiceFunctions List New; "<a href=\"evolution.asmx?op=" ;"\">" ; 0 ; "" )

                   Function:

              ParseAllBetween ( source ; start ; stop ; startPos ; result )

              Let ([

                  first = Position ( source; start; startPos; 1 );

                  firstPos = first + Length(start);

                  end = Position ( source; stop; firstPos; 1 );

                  chars = end - firstPos

              ];

                    

                  If ( first ≠ 0;

                      ParseAllBetween( source; start; stop; end + Length ( stop); List ( result ; Middle ( source ; firstPos ; chars)));

                      result

                  )

              )