Problem with DELCHR

Hi everyone,
I am using an xmlport to export decimal fields into a text file.
For the decimals in thousands, for exmple 1 758.245, the generated text file shows 1ÿ758.245 :(
I tried to remove the blank space by writing the following code:

amount:=FORMAT(totalAmount);
FOR K := 1 TO strlen(amount) DO
BEGIN
IF ((amount[K] <> '0') AND (amount[K] <> '1') AND (amount[K] <> '2') AND (amount[K] <> '3') AND
(amount[K] <> '4') AND (amount[K] <> '5') AND (amount[K] <> '6') AND (amount[K] <> '7') AND
(amount[K] <> '8') AND (amount[K] <> '9')
) THEN
BEGIN
NotNum := amount[K];
amount:= DELCHR(amount,'=',NotNum);
END;
END;
``

but it didn’t work :(:(
What shall I do???

Could you say what it is you’re trying to do? Why don’t you just use FORMAT to get the Decimal number in the format you need?

Hi,

Which Country/Region NAV you are using (W1/ NA/ IN/ GB), based on that change thousand separator in your regional settings so that you will not get that special character when exporting to external file.

Thanks

Marshal

I already explained that, I am trying to remove the blanck caused by the thousand separator…

I tried FORMAT before posting this topic but it didn’t work, strange, isn’t it???

Anyway, I found the solution :

txtCharsToKeep := '0123456789';
amount := DELCHR(amount,'=',DELCHR(amount,'=',txtCharsToKeep));

where txtCharsToKeep is a text variable.
Applying this code, the space was removed

If you insist on doing it this rather strange way, then ok with me.

But why don’t you just use FORMAT(TotalAmount,0,1)?

The way the amount is exported without any spaces or thousand-dots etc. The format used is global:

In fact if the XML file you’re creating is for integrating with other systems, then you can also use FORMAT(TotalAmount,0,9) - format number 9 is the standard XML file decimal format.