Re: localisation (again)

2017-12-13 Thread Alan Chan via 4D_Tech
Alternative simplified version of Num for this situation

C_REAL($0;$num)  //same as ES_num yet support decimal
C_TEXT($1)
C_LONGINT($len;$i;$k;$j)
$num:=0
$len:=Length($1)
For ($i;$len;1;-1)
$k:=Character code($1[[$i]])
If (($k>47) & ($k<58))
$num:=$num+(($k-48)*(10^($len-$i-$j)))
Else 
If ($k=46)  //decimal
$num:=$num*(10^-($len-$i-$j))
$len:=$i
$j:=1  //$j+1
Else 
$len:=$len-1
End if 
End if 
End for 
If ($k=45)
$num:=$num*-1
End if 
$0:=$num

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Hi
>But Thats what I'm doing, and its not working.
>
>The string looks like "12345.12345" and the Conversion looks like
>
>C_REAL($Number)
>C_TEXT($NumString)
>$NumString:-"12345.12345"
>$Number:=Num($NumString;".")
>
>On a UK system $Number = 12345.12345
>On a German system $Number = 12345
>
>any ideas would be very welcome
>Im considering using replace string on $numString to replace "." with the
>local separator, in this case ","
>
>thanks
>-pm
>
>On Wed, Dec 13, 2017 at 2:32 AM, Chuck Miller via 4D_Tech <
>4d_tech@lists.4d.com> wrote:
>
>> Much better than my choice which was substring till the period and then num
>>
>> Regards
>>
>> Chuck
>> 
>> 
>>  Chuck Miller Voice: (617) 739-0306
>>  Informed Solutions, Inc. Fax: (617) 232-1064
>>  mailto:cjmillerinformed-solutions.com
>>  Brookline, MA 02446 USA Registered 4D Developer
>>Providers of 4D and Sybase connectivity
>>   http://www.informed-solutions.com
>> 
>> 
>> This message and any attached documents contain information which may be
>> confidential, subject to privilege or exempt from disclosure under
>> applicable law.  These materials are intended only for the use of the
>> intended recipient. If you are not the intended recipient of this
>> transmission, you are hereby notified that any distribution, disclosure,
>> printing, copying, storage, modification or the taking of any action in
>> reliance upon this transmission is strictly prohibited.  Delivery of this
>> message to any person other than the intended recipient shall not
>> compromise or waive such confidentiality, privilege or exemption from
>> disclosure as to this communication.
>>
>> > On Dec 12, 2017, at 7:22 PM, Keisuke Miyako via 4D_Tech <
>> 4d_tech@lists.4d.com> wrote:
>> >
>> > the second "separator" argument for Num() has existed and has been a
>> "must use" feature since v11 for i18n.
>> >
>> > http://doc.4d.com/4Dv16/4D/16.3/Num.301-3651255.en.html <
>> http://doc.4d.com/4Dv16/4D/16.3/Num.301-3651255.en.html>
>>
>> **
>> 4D Internet Users Group (4D iNUG)
>> FAQ:  http://lists.4d.com/faqnug.html
>> Archive:  http://lists.4d.com/archives.html
>> Options: http://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **
>>
>**
>4D Internet Users Group (4D iNUG)
>FAQ:  http://lists.4d.com/faqnug.html
>Archive:  http://lists.4d.com/archives.html
>Options: http://lists.4d.com/mailman/options/4d_tech
>Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>**

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: localisation (again)

2017-12-13 Thread Chip Scheide via 4D_Tech
as a work around:
$Loc:=position("."; imported_Text_Number)
$Text_Integer:=substring($imported_Text_Number;1;$Loc-1)
$Integer:=Num($Text_Integer)
$Text_Integer:=substring(imported_Text_Number;$Loc+1)
$Decimal:=num($Text_Integer)
$Final_Value:=$Integer+($Decimal/(10*length($Text_Integer)))

Given "1234.5678" the above should give you
Integer=1234
$Decimal:=5678
$Final_Value=1234.5678

Please note: all of the above code typed in email 

On Tue, 12 Dec 2017 23:13:20 +, Peter Mew via 4D_Tech wrote:
> The imported file is always a string and the part I need is always a
> substring that looks like "123456.1234567890"
> The decimal separator is always a period
> The num function needs to work on systems that have either the period or
> the comma, as the native decimal separator
> thanks
> -pm
> 
> On Tue, Dec 12, 2017 at 10:19 PM, Charles Miller via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> 
>> If this is always a long why is the striking .XX or ,XX
>> It might be simpler but I would first doa substrinmg from 1 to position of
>> either , or . and then a num on that.
>> You will have to identify what system you are on and what localization is
>> set to and then understand what localization created text file for import
>> 
>> 
>> Regards
>> 
>> Chuck
>> 
>> On Tue, Dec 12, 2017 at 4:24 PM, Peter Mew via 4D_Tech <
>> 4d_tech@lists.4d.com
>>> wrote:
>> 
>>> Hi
>>> I thought I had this understood, but aparrently not.
>>> Im Importing some numbers from a file as strings.The Numbers have a
>> period
>>> as decimal point.
>>> Because they are long decimal numbers and I need to do some calculations
>> I
>>> convert them to longints with NUM()
>>> everything works fine on a UK system that has its decimal point as a
>> period
>>> When I run on a German system that has its a comma as its decimal point
>> the
>>> conversion screws up
>>> So I tried using NUM(string;".") as the conversion (I thought, to force
>> the
>>> Decimal point to be a period)
>>> but this seems to make no difference as the conversion,  is still
>> sccrewed
>>> up.
>>> Could Someone point me in the direction of what I've misunderstood.
>>> Thanks
>>> -pm
>>> Im testing this by changing the localisation on the mac to German, and
>>> comma as the decimal point.
>>> Mac OS 10.10.5 4D v13.6
>>> **
>>> 4D Internet Users Group (4D iNUG)
>>> FAQ:  http://lists.4d.com/faqnug.html
>>> Archive:  http://lists.4d.com/archives.html
>>> Options: http://lists.4d.com/mailman/options/4d_tech
>>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>>> **
>> 
>> 
>> 
>> 
>> --
>> 
>> -
>>  Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
>>  Informed Solutions, Inc.
>>  Brookline, MA 02446 USA Registered 4D Developer
>>Providers of 4D, Sybase & SQL Server connectivity
>>   http://www.informed-solutions.com
>> 
>> -
>> This message and any attached documents contain information which may be
>> confidential, subject to privilege or exempt from disclosure under
>> applicable law.  These materials are intended only for the use of the
>> intended recipient. If you are not the intended recipient of this
>> transmission, you are hereby notified that any distribution, disclosure,
>> printing, copying, storage, modification or the taking of any action in
>> reliance upon this transmission is strictly prohibited.  Delivery of this
>> message to any person other than the intended recipient shall not
>> compromise or waive such confidentiality, privilege or exemption
>> from disclosure as to this communication.
>> **
>> 4D Internet Users Group (4D iNUG)
>> FAQ:  http://lists.4d.com/faqnug.html
>> Archive:  http://lists.4d.com/archives.html
>> Options: http://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **
---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com

Re: localisation (again)

2017-12-13 Thread Peter Mew via 4D_Tech
Hi
But Thats what I'm doing, and its not working.

The string looks like "12345.12345" and the Conversion looks like

C_REAL($Number)
C_TEXT($NumString)
$NumString:-"12345.12345"
$Number:=Num($NumString;".")

On a UK system $Number = 12345.12345
On a German system $Number = 12345

any ideas would be very welcome
Im considering using replace string on $numString to replace "." with the
local separator, in this case ","

thanks
-pm

On Wed, Dec 13, 2017 at 2:32 AM, Chuck Miller via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Much better than my choice which was substring till the period and then num
>
> Regards
>
> Chuck
> 
> 
>  Chuck Miller Voice: (617) 739-0306
>  Informed Solutions, Inc. Fax: (617) 232-1064
>  mailto:cjmillerinformed-solutions.com
>  Brookline, MA 02446 USA Registered 4D Developer
>Providers of 4D and Sybase connectivity
>   http://www.informed-solutions.com
> 
> 
> This message and any attached documents contain information which may be
> confidential, subject to privilege or exempt from disclosure under
> applicable law.  These materials are intended only for the use of the
> intended recipient. If you are not the intended recipient of this
> transmission, you are hereby notified that any distribution, disclosure,
> printing, copying, storage, modification or the taking of any action in
> reliance upon this transmission is strictly prohibited.  Delivery of this
> message to any person other than the intended recipient shall not
> compromise or waive such confidentiality, privilege or exemption from
> disclosure as to this communication.
>
> > On Dec 12, 2017, at 7:22 PM, Keisuke Miyako via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> >
> > the second "separator" argument for Num() has existed and has been a
> "must use" feature since v11 for i18n.
> >
> > http://doc.4d.com/4Dv16/4D/16.3/Num.301-3651255.en.html <
> http://doc.4d.com/4Dv16/4D/16.3/Num.301-3651255.en.html>
>
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **
>
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: localisation (again)

2017-12-12 Thread Chuck Miller via 4D_Tech
Much better than my choice which was substring till the period and then num

Regards

Chuck

 Chuck Miller Voice: (617) 739-0306
 Informed Solutions, Inc. Fax: (617) 232-1064   
 mailto:cjmillerinformed-solutions.com 
 Brookline, MA 02446 USA Registered 4D Developer
   Providers of 4D and Sybase connectivity
  http://www.informed-solutions.com  

This message and any attached documents contain information which may be 
confidential, subject to privilege or exempt from disclosure under applicable 
law.  These materials are intended only for the use of the intended recipient. 
If you are not the intended recipient of this transmission, you are hereby 
notified that any distribution, disclosure, printing, copying, storage, 
modification or the taking of any action in reliance upon this transmission is 
strictly prohibited.  Delivery of this message to any person other than the 
intended recipient shall not compromise or waive such confidentiality, 
privilege or exemption from disclosure as to this communication. 

> On Dec 12, 2017, at 7:22 PM, Keisuke Miyako via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> the second "separator" argument for Num() has existed and has been a "must 
> use" feature since v11 for i18n.
> 
> http://doc.4d.com/4Dv16/4D/16.3/Num.301-3651255.en.html 
> 

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: localisation (again)

2017-12-12 Thread Keisuke Miyako via 4D_Tech
the second "separator" argument for Num() has existed and has been a "must use" 
feature since v11 for i18n.

http://doc.4d.com/4Dv16/4D/16.3/Num.301-3651255.en.html

> 2017/12/13 8:13、Peter Mew via 4D_Tech <4d_tech@lists.4d.com> のメール:
> The imported file is always a string and the part I need is always a
> substring that looks like "123456.1234567890"
> The decimal separator is always a period
> The num function needs to work on systems that have either the period or
> the comma, as the native decimal separator



**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: localisation (again)

2017-12-12 Thread Peter Mew via 4D_Tech
The imported file is always a string and the part I need is always a
substring that looks like "123456.1234567890"
The decimal separator is always a period
The num function needs to work on systems that have either the period or
the comma, as the native decimal separator
thanks
-pm

On Tue, Dec 12, 2017 at 10:19 PM, Charles Miller via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> If this is always a long why is the striking .XX or ,XX
> It might be simpler but I would first doa substrinmg from 1 to position of
> either , or . and then a num on that.
> You will have to identify what system you are on and what localization is
> set to and then understand what localization created text file for import
>
>
> Regards
>
> Chuck
>
> On Tue, Dec 12, 2017 at 4:24 PM, Peter Mew via 4D_Tech <
> 4d_tech@lists.4d.com
> > wrote:
>
> > Hi
> > I thought I had this understood, but aparrently not.
> > Im Importing some numbers from a file as strings.The Numbers have a
> period
> > as decimal point.
> > Because they are long decimal numbers and I need to do some calculations
> I
> > convert them to longints with NUM()
> > everything works fine on a UK system that has its decimal point as a
> period
> > When I run on a German system that has its a comma as its decimal point
> the
> > conversion screws up
> > So I tried using NUM(string;".") as the conversion (I thought, to force
> the
> > Decimal point to be a period)
> > but this seems to make no difference as the conversion,  is still
> sccrewed
> > up.
> > Could Someone point me in the direction of what I've misunderstood.
> > Thanks
> > -pm
> > Im testing this by changing the localisation on the mac to German, and
> > comma as the decimal point.
> > Mac OS 10.10.5 4D v13.6
> > **
> > 4D Internet Users Group (4D iNUG)
> > FAQ:  http://lists.4d.com/faqnug.html
> > Archive:  http://lists.4d.com/archives.html
> > Options: http://lists.4d.com/mailman/options/4d_tech
> > Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> > **
>
>
>
>
> --
> 
> -
>  Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
>  Informed Solutions, Inc.
>  Brookline, MA 02446 USA Registered 4D Developer
>Providers of 4D, Sybase & SQL Server connectivity
>   http://www.informed-solutions.com
> 
> -
> This message and any attached documents contain information which may be
> confidential, subject to privilege or exempt from disclosure under
> applicable law.  These materials are intended only for the use of the
> intended recipient. If you are not the intended recipient of this
> transmission, you are hereby notified that any distribution, disclosure,
> printing, copying, storage, modification or the taking of any action in
> reliance upon this transmission is strictly prohibited.  Delivery of this
> message to any person other than the intended recipient shall not
> compromise or waive such confidentiality, privilege or exemption
> from disclosure as to this communication.
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: localisation (again)

2017-12-12 Thread Charles Miller via 4D_Tech
If this is always a long why is the striking .XX or ,XX
It might be simpler but I would first doa substrinmg from 1 to position of
either , or . and then a num on that.
You will have to identify what system you are on and what localization is
set to and then understand what localization created text file for import


Regards

Chuck

On Tue, Dec 12, 2017 at 4:24 PM, Peter Mew via 4D_Tech <4d_tech@lists.4d.com
> wrote:

> Hi
> I thought I had this understood, but aparrently not.
> Im Importing some numbers from a file as strings.The Numbers have a period
> as decimal point.
> Because they are long decimal numbers and I need to do some calculations I
> convert them to longints with NUM()
> everything works fine on a UK system that has its decimal point as a period
> When I run on a German system that has its a comma as its decimal point the
> conversion screws up
> So I tried using NUM(string;".") as the conversion (I thought, to force the
> Decimal point to be a period)
> but this seems to make no difference as the conversion,  is still sccrewed
> up.
> Could Someone point me in the direction of what I've misunderstood.
> Thanks
> -pm
> Im testing this by changing the localisation on the mac to German, and
> comma as the decimal point.
> Mac OS 10.10.5 4D v13.6
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **




-- 
-
 Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
 Informed Solutions, Inc.
 Brookline, MA 02446 USA Registered 4D Developer
   Providers of 4D, Sybase & SQL Server connectivity
  http://www.informed-solutions.com
-
This message and any attached documents contain information which may be
confidential, subject to privilege or exempt from disclosure under
applicable law.  These materials are intended only for the use of the
intended recipient. If you are not the intended recipient of this
transmission, you are hereby notified that any distribution, disclosure,
printing, copying, storage, modification or the taking of any action in
reliance upon this transmission is strictly prohibited.  Delivery of this
message to any person other than the intended recipient shall not
compromise or waive such confidentiality, privilege or exemption
from disclosure as to this communication.
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

localisation (again)

2017-12-12 Thread Peter Mew via 4D_Tech
Hi
I thought I had this understood, but aparrently not.
Im Importing some numbers from a file as strings.The Numbers have a period
as decimal point.
Because they are long decimal numbers and I need to do some calculations I
convert them to longints with NUM()
everything works fine on a UK system that has its decimal point as a period
When I run on a German system that has its a comma as its decimal point the
conversion screws up
So I tried using NUM(string;".") as the conversion (I thought, to force the
Decimal point to be a period)
but this seems to make no difference as the conversion,  is still sccrewed
up.
Could Someone point me in the direction of what I've misunderstood.
Thanks
-pm
Im testing this by changing the localisation on the mac to German, and
comma as the decimal point.
Mac OS 10.10.5 4D v13.6
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**