Help modifying a custom function
I need a little help modifying this custom function.
// ExtractData ( XML, Attribute, Instance )
Let ( [
XML_Length = Length ( XML ) ;
Attribute_Length = Length ( Attribute ) ;
Get_Instance = If ( IsEmpty ( Instance ) ; 1 ; Instance )
IsEmpty ( XML ) or IsEmpty ( attribute ) or PatternCount ( xml ; "<" & attribute & ">" ) = 0 ; "" ;
Middle ( XML ; Position ( XML ; "<" & attribute & ">" ; 1 ; Get_Instance ) + attribute_length + 2 ;
xml_length - ( xml_length - Position ( XML ; "</" & attribute & ">" ; 1 ; Get_Instance ) ) - ( Position ( XML ; "<" & attribute & ">" ; 1 ; Get_Instance ) + Attribute_Length + 2 ) )
I am using it in a field like this:
IdCustomer calculation = ExtractData ( result ; "IdCustomer" ; EventNumber )
The EventNumber field I use to change numbers in place of the instance to get the next set of data from the XML. the only problem is, is if the
instance is empty, it gives me the next instance of info. So if I have an EventNumber of 8, and the IDCustomer instance for 8 is empty
it gives me instance 9, or the next one with data. I want it to give me the empty data, so I can keep the empty data with the correct record. I use this
in a solution that accesses a web service, and this particular one pulls info from a website as ViewAllCustomers, in one very long
xml file. I have a script that starts at instance 1 and uses set variable on all fields, gos to another layout and creates a record from the parsed
data, gos back to the origianal layout and adds 1 to the EventNumber to view data of the next record and gos to the other layout to create a new record.
When a particular field is empty, the loop stops.
Any assistance will be much appreciated.