Problem importing XML with space char in decimal values

lzrlzr Member Posts: 264
I have an XML file where the thousand separator is coded like this
 

No matter how I do try to solve it with text strings, strpos etc I can't get it to work. Does anyone have an idea on how to import this?

XML:

<MASS>81 018,667297284</MASS>
IF STRPOS(InMass, ' ') > 0 THEN
    InMass := DELSTR(InMass, STRPOS(InMass, ' '), 6);

  IF InMass <> '' THEN
    EVALUATE(drawing.Mass, InMass);

NAV just gives me the error message:
You cannot enter 81 018,667297284 in Decimal
Navision developer

Comments

  • David_CoxDavid_Cox Member Posts: 509
    Is it stil leaving a space in the InMass after 81 when you delete the string, as you say, you cannot enter 81 018,667297284 in Decimal
    IF STRPOS(InMass, ' ') > 0 THEN
        InMass := DELSTR(InMass, STRPOS(InMass, ' '), 6);
    
    //Remove spaces inside the string
    //NewString := DELCHR(String[, Where][, Which]);
    //If Where contains =, then all the spaces are deleted from String
    InMass := DELSTR(InMass, '=');
    
    IF InMass <> '' THEN
      EVALUATE(drawing.Mass, InMass); 
    

    This should now have 81018,667297284 in the Variable INMass

    HTH

    David
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • lzrlzr Member Posts: 264
    Thanks but the problem is that this does not trigger:
    IF STRPOS(InMass, ' ') > 0 THEN
        InMass := DELSTR(InMass, STRPOS(InMass, ' '), 6);
    

    I am guessing that it's a problem where NAV interprets as a special character. I have tried with just the strpos(InMass, ' ') but that doesn't trigger either
    Navision developer
  • David_CoxDavid_Cox Member Posts: 509
    Hi
    Can you screenshot the actual error message, is the value always to the same number of decimals or variable, and confirm that the comma ',' is the decimal point?

    Regards

    David
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
Sign In or Register to comment.