1 Reply Latest reply on Jun 6, 2014 2:01 PM by philmodjunk

    Help Parsing Html field

    billsayagh

      Title

      Help Parsing Html field

      Post

      I have a field with html as this:

           <h2>Milwaukee 48-59-1812 M18 and M12 Multi-Voltage Charger Features</h2>
           <ul>
           <li>Charger compatible with M12 battery packs:  48-11-2401,  48-11-2402</li>
           </ul>

           <h2>Milwaukee 48-59-1812 M18 and M12 Multi-Voltage Charger Specifications</h2>
           <ul>
           <li>Model:  48-59-1812</li>
           <li>Weight     2.01 lbs</li>
           </ul>

           <h2>Milwaukee 48-59-1812 M18 and M12 Multi-Voltage Charger Includes</h2>
           <ul>
           <li>(1) M18 and M12 Li-Ion Battery Charger</li>
           </ul>

            

      I have been trying to parse the data in three fields, one for features, one for specs, and one for what the kit includes. I am trying to use the space between </ul> <h2> as the separator to get Product Specs to parse as  

           <h2>Milwaukee 48-59-1812 M18 and M12 Multi-Voltage Charger Specifications</h2>
           <ul>
           <li>Model:  48-59-1812</li>
           <li>Weight     2.01 lbs</li>
           </ul>


           I used the function bellow but it did not amount to anything:

      Middle ( ProductDescription ; Position ( ProductDescription ; " " ; 1 ; 1 ) + 1 ; Position ( ProductDescription ; " " ; 1 ; 2 )  - Position ( ProductDescription ; " " ; 1 ; 1 ))

      Is there anything i have to change in my formula to achieve that. Any help in the matter will be greatly appreciated.
      Thank you

            

        • 1. Re: Help Parsing Html field
          philmodjunk

               I tested this calculation with a Watch expression in the Data Viewer of FileMaker Advanced 13

               Why find the position of space characters?

          Position ( ProductDescription ; " " ; 1 ; 1 )

               returns the position of the space between "Milwaukee" and "48-59-1812"

          Position ( ProductDescription ; " " ; 1 ; 2 )

               Would be the position of the space immediately after "48-59-1812" and before "M18"

               Thus, this should return "48-59-1812 " (note the space at the end) and only if the spaces between the text are really spaces, only one space and only if no other spaces appear in this text prior to the first visible character--details that can be easy to miss when analyzing the text to figure out how to parse it.

               I don't see how that will:

               

                    Use the space between </ul> <h2> as the separator to get Product Specs to parse