August 20, 20196 yr Having a major crisis lol... I have a script that downloads XML, and then parses it out. Worked fine forever, now it says it can't calculate it because it's over 30,000 characters. Anyone know where to start? Thanks!
August 20, 20196 yr Why don't you import the XML directly, using an XSLT stylesheet? I don't see your script (or your XML), but in general parsing XML using Filemaker's calculation engine is highly inadvisable.
August 20, 20196 yr Author Hey comment! I will hire someone to do that, at the moment I'm just trying to get it to work like it did for a year, can't figure out what happened.... The part that doesn't work anymore: Set Variable [$XML; Value: CleanApiResponse ($XML)] Set Variable [$StatusCode; Value: GetXMLNode ($XML ; "/Response[1]/Status[1]/Code[1]" )] The problem is the $XML variable is over 30,000 characters so the response is always a "?". My XML has always been in the hunderds of thousands of characters so I'm not sure why this morning it stopped working. Would you be willing to help me? I can pay a retainer, or by the hour, etc. I'm stuck. I have three employees sitting around and I can't solve it (yet).
August 20, 20196 yr 6 minutes ago, JTSmith said: The problem is the $XML variable is over 30,000 characters so the response is always a "?" That doesn't seem a likely reason. AFAIK, variables are limited only by available memory. The 30k characters limit applies to calculation formulas. -- I sent you a private message.
August 20, 20196 yr Author I don't understand it... If I do a parse type calculation on the variable it works, but not the custom function "GetXMLNode". I created a field and put the XML in it. I used Data Viewer to try calculations. If I use GetXMLNode function it says "Field Missing". If I make the XML text less than 30,000 characters, it works. The GetXMLNode uses a function as well, maybe that's why? Not sure why it works for a year and then stops.
August 20, 20196 yr Author I created a new solution, just one field "XML". Using DataViewer it still won't evaluate it if the XML is over 30k, so it's got to be a sudden filemaker thing.
August 21, 20196 yr Sounds like a issue with the custom. I’ve never had this issue and parse way over 30k. I use the base element plugin.
August 21, 20196 yr So if no updates to the system have been done.. and Computer has been restarted and your still having an issue then either the custom or the XML it's self is bad.. Can you go back and parse an older XML that did work? We are kinda blind as we don't have the XML that our trying to parse.
August 21, 20196 yr Author I opened an old version of the database, a backup copy, still doesn't work. It's seems as if FM just changed, which doesn't make sense. When I use DataViewer in Debugger, it shows the XML, then for the GetXMLNode set to variable it has a question mark. When I change the variable in DataViewer, it gives an error saying it has to be less than 30,000 characters to change the variable.
August 21, 20196 yr We cannot tell the reason without seeing what GetXMLNode() does. If it uses the Evaluate() function, then it certainly could run against the 30k characters limit. And I am not sure there is a quick fix for that. Edited August 21, 20196 yr by comment
August 21, 20196 yr Author Ok, I think I may have an idea after 14 hours... One of the machines that remote logins was using Pro 18 Advanced and the file was hosted on 16. I am wondering if it's a recursive issue or something. GetXMLNode: Evaluate ( Substitute ( Filter ( XPath ; "/" ) ; "/" ; "ExtractData ( " ) & "\"" & XML & "\"" & Substitute ( XPath ; [ "/" ; ";\"" ] ; [ "[" ; "\";" ] ; [ "]" ; ")" ] ) ) **It used the custom function ExtractData: Let ( [ XML_Length = Length ( XML ) ; Attribute_Length = Length ( Attribute ) ; Get_Instance = If ( IsEmpty ( Instance ) ; 1 ; Instance ) ]; Case( 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 ) ) ) )
August 21, 20196 yr Without getting in too deep, it's easy to see that your GetXMLNode() function builds a formula to be evaluated by the Evaluate() function. - and that the formula includes the entire XML. So if the XML exceeds 30k characters, this will fail. This is just another example of how fragile any attempts to parse XML using text functions are. Edited August 21, 20196 yr by comment
Create an account or sign in to comment