ARRRGGGGGHHH  i got the problem! That should be related how JAVA interprets numbers in 
diferent locales.

Using Locale("portuguese(Brazilian)") in CF5, the number #DecimalFormat(14.57)# was 
displayed as 14.57. In CFMX, it is displayed as 14,57 (note the coma). 

So, in my COM object, when i try to pass the value 0.50, witch means 500g as weight, 
it interprets as 50kg, returning a wrong shipping charge. I didnt notice that beuse 
the value returned by the COM is used in other expressions to calculate the shipping.

I did a workaround as follow: 
=======
.........
 <cfobject type="COM" name="tar" class="Tarifa.clsServicoDLL" action="Create">
      <cfset CtErro = tar.CalcularTarifa("#attributes.servico#", 
"#attributes.cepInicial#", "#attributes.cepFinal#", "#DecimalFormat(pesoKg)#")>

      <cfswitch expression="#CtErro#">
          <cfcase value="1">
           <cfset ValorTarifa = tar.ValorTarifa / 1000> (NOTE THE / 1000)
          </cfcase>
      </cfswitch>


You gotta love Macromedia.....

BTW, am i the only brazilian in this list? =)

Cheers

  ----- Original Message ----- 
  From: Leonardo Crespo - Cftop.COM 
  To: CF-Talk 
  Sent: Wednesday, February 26, 2003 12:22 PM
  Subject: Urgent problem with COM and CFMX


  Hi, i used to have a COM object (Tarifa.dll) that connects to a .MDB database to 
calculate shipping charges for my e-commerce. Both files were provided by the a the 
govern shipping company (i have no idea how to say that in english). 

  Everything works fine with cf5, but when i migrate to cfmx, i got the following 
error: 

  -------------------------------
  Error casting an object of type java.lang.Double to an incompatible type. This 
usually indicates a programming error in Java, although it could also mean you have 
tried to use a foreign object in a different way than it was designed. 
java.lang.Double 
        --------------------
        Since i know nothing about java, i dont know where to start. Code was working 
fine, files are registered with regsvr32 and in place. all the attributes where passed 
as usually with cf5. My code for the custom tag is: 
        ==========================
        <cfset pesoKg = attributes.peso / 1000>
        <cfobject type="COM" name="tar" class="Tarifa.clsServicoDLL" action="Create">
        <cfset CtErro = tar.CalcularTarifa("#attributes.servico#", 
"#attributes.cepInicial#", "#attributes.cepFinal#", pesoKg)>

        <cfswitch expression="#CtErro#">
            <cfcase value="1">
             <cfset ValorTarifa = tar.ValorTarifa>
            </cfcase>
        </cfswitch>

        <!--- zera variaveis --->
        <cfset tar="">
        <cfset tarSerAd="">
        ==============================

        If i remove all the lines exept the cfobject, it does not show errors. I think 
the problem is in the line:

        <cfset CtErro = tar.CalcularTarifa("#attributes.servico#", 
"#attributes.cepInicial#", "#attributes.cepFinal#", pesoKg)>

        I tried to wrap "#pesoKG#" in quotes, no sucess. The only way i can make this 
error dissaper is by using the #ToString(pesoKG)#, but this leads me to incorrect 
values (very incorrect) returned by the COM object. 

        If you have some experience, please let me know what kind of error this is and 
where should i look for to try to fix it. Should this be code related? 

        THANK YOU VERY MUCH!
        icq: 198810 

  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to