Jump to content
Server Maintenance This Week. ×

Calculation Help


This topic is 1710 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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!

Link to comment
Share on other sites

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).

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.  

Link to comment
Share on other sites

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.  

Link to comment
Share on other sites

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.  

 

Link to comment
Share on other sites

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 by comment
Link to comment
Share on other sites

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 ) )
) )

Link to comment
Share on other sites

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 by comment
Link to comment
Share on other sites

This topic is 1710 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.