comparing two variables with commas in

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
SigS
Newbie
Posts: 2
Joined: Mon Jan 22, 2007 1:13 pm

comparing two variables with commas in

Post by SigS » Mon Jan 22, 2007 1:42 pm

I´ve tried to do the following:
comparing two variables and decide which one is bigger.

Comparing 98,89 with 99,01: it works,
comparing 98,89 with 1000,01: it doesn´t works
comparing 98,89 with 100,01: the same, it doesn´t works;
the addition of these values works!

After I notice this, I think this is crazy, but please have a look to my example code, to test it:

Code: Select all

Let>Wertb=98,89
Let>Werta=99,01

Let>Summe=Werta+Wertb

messagemodal>%Summe% ok!

If>%Werta%>%Wertb%
messagemodal>%Werta%>%Wertb% ok!
else
messagemodal>mistake !
endif

Let>Wertb=98,89
Let>Werta=1000,01

Let>Summe=Werta+Wertb

messagemodal>%Summe%

If>%Werta%>%Wertb%
messagemodal>%Werta%>%Wertb% ok!
else
messagemodal>mistake !
endif

Let>Wertb=98,89
Let>Werta=100,01

Let>Summe=Werta+Wertb

messagemodal>%Summe%

If>%Werta%>%Wertb%
messagemodal>%Werta%>%Wertb% ok!
else
messagemodal>mistake !
endif
In Germany we always work with "commas", you know. Is their an easy way to solve this problem, or have I to transform the "commas" in dots?
I know the "stringreplace" command and the trick with the "comma" handling.

Best regards,

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Jan 22, 2007 4:22 pm

Try this: I created two subroutines GermanToEnglish and EnglishToGerman and inserted them into the appropriate places.

Code: Select all

Let>dot=.
Let>comma=,
Let>Wertb=97,89
GoSub>GermanToEnglish,%Wertb%
Let>Wertb=%EnglishNum%

Let>Werta=99,01
GoSub>GermanToEnglish,%Werta%
Let>Werta=%EnglishNum%

Let>Summe=%Werta%+%Wertb%

GoSub>EnglishToGerman,%Summe%
Let>Summe=%GermanNum%

messagemodal>%Summe% ok!

If>%Werta%>%Wertb%
  GoSub>EnglishToGerman,%Werta%
  Let>Werta=%GermanNum%

  GoSub>EnglishToGerman,%Wertb%
  Let>Wertb=%GermanNum%

  messagemodal>%Werta%>%Wertb% ok!
else
  messagemodal>mistake !
endif

Let>Wertb=98,89
GoSub>GermanToEnglish,%Wertb%
Let>Wertb=%EnglishNum%

Let>Werta=1000,01
GoSub>GermanToEnglish,%Werta%
Let>Werta=%EnglishNum%

Let>Summe=Werta+Wertb
GoSub>EnglishToGerman,%Summe%
Let>Summe=%GermanNum%

messagemodal>%Summe%

If>%Werta%>%Wertb%
  GoSub>EnglishToGerman,%Werta%
  Let>Werta=%GermanNum%

  GoSub>EnglishToGerman,%Wertb%
  Let>Wertb=%GermanNum%

  messagemodal>%Werta%>%Wertb% ok!
else
  messagemodal>mistake !
endif

Let>Wertb=98,89
GoSub>GermanToEnglish,%Wertb%
Let>Wertb=%EnglishNum%

Let>Werta=100,01
GoSub>GermanToEnglish,%Werta%
Let>Werta=%EnglishNum%

Let>Summe=Werta+Wertb
GoSub>EnglishToGerman,%Summe%
Let>Summe=%GermanNum%

messagemodal>%Summe%

If>%Werta%>%Wertb%
  GoSub>EnglishToGerman,%Werta%
  Let>Werta=%GermanNum%

  GoSub>EnglishToGerman,%Wertb%
  Let>Wertb=%GermanNum%

  messagemodal>%Werta%>%Wertb% ok!
else
  messagemodal>mistake !
endif

SRT>GermanToEnglish
Separate>%GermanToEnglish_var_1%,comma,var
If>%var_count%>1
  Let>EnglishNum=
  Concat>EnglishNum,%var_1%%dot%%var_2%
EndIf
END>GermanToEnglish

SRT>EnglishToGerman
Separate>%EnglishToGerman_var_1%,%dot%,var
If>%var_count%>1
  Let>GermanNum=
  Concat>GermanNum,%var_1%%comma%%var_2%
EndIf
END>EnglishToGerman

SigS
Newbie
Posts: 2
Joined: Mon Jan 22, 2007 1:13 pm

Post by SigS » Mon Jan 22, 2007 4:45 pm

yes, this sounds good,

I´ll try it,

thanks a lot

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts