vbscriptpervasiveactian

Convert vbscript into rapid integration flowlanguage


I'm using Pervasive 9.2 and would like to somehow convert the vbscript into pervasives RIFL language. I want to execute the code during a Process where the f(x) component is executed to run the code. As far as the Path to the xml data, I'll be using a Macro defining where the source data is and another to save the file as well.

Here is the vbscript code below:

Set xml = CreateObject("Microsoft.XMLDOM")

xml.async = False
count_var = 1

If xml.Load("c:\folder1\test.xml") Then             
    For Each accounts In xml.SelectNodes("//Accounts")               
        For Each account In Accounts.SelectNodes("./Account")      
            If count_var > 1 Then           
                Set accountEnum = xml.createNode(1, "Account" & count_var, "")                                      
                For Each child In Account.childNodes                                                
                    accountEnum.appendChild(child.cloneNode(TRUE))                    
                Next
                Accounts.replaceChild accountEnum, Account          

                xml.save("c:\folder1\test.xml")

            else                     
               Set accountEnum = xml.createNode(1, "Account" & count_var, "")

               For Each child In Account.childNodes
                  accountEnum.appendChild(child.cloneNode(TRUE))
               Next       
               Accounts.replaceChild accountEnum, Account           

               xml.save("c:\folder1\test.xml")        

              End If
              count_var = count_var + 1

        Next           
        count_var = 1   
    Next
End If

Set node = Nothing
 Set xml = Nothing

Solution

  • ParseXMLFile(filepath)

    documentation here

    http://docs.pervasive.com/products/integration/di/rifl/wwhelp/wwhimpl/common/html/wwhelp.htm#href=ParseXMLFile_Function.html&single=true

    this will return a DOMDocument Object Type

    documentation here

    http://docs.pervasive.com/products/integration/di/rifl/wwhelp/wwhimpl/common/html/wwhelp.htm#href=DOMDocument_Object_Type.html&single=true

    hope this helps