function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
efantiniefantini 

update double field using SForceOfficeToolkit

I've used the SforceOfficeToolkit library in a VBA application that read data in Excel sheet and update fields in Salesforce. 

Field type string and integer are updated corretly but double updated doesn't work: this is the error message returned by the object SForceSession:  "java.lang.NumberFormatException: For input string:...."

this is my code:

    Dim sobj As SForceOfficeToolkitLib.SObject
       
    Set sobj = sf.CreateObject("Account")
       
    sobj.Item("ID").Value = "00130000005T3f7AAC"
    sobj.Item("NumberOfEmployees").Value = 20
    sobj.Item("doublefield__c").Value = 0,34         (for xample)
     sobj.Update

What is the problem?

Thanks in advance

bouscalbouscal

Because there is a comma in your value, the connection string is seeing it as two separate values.

HTH

 

Tim

efantiniefantini

that's all right, but how do I have to write the value to update in the double field salesforce?

If I use a point separator for decimal values the update method doesn't return any error but the value in salesforce doesn't appear correctly (for example if I write 12.50 in salesforce appear 1250.0)

Any suggestion?

Thanks in advance 

 

 

bouscalbouscal

This is cut from Ron's code in the Excel connector;


    ' 5.47 not all doubles are create equal, following is excerpted from the Sforce API help
    '
    '   For example, salesforce.com chooses to interpret a double value
    ' passed via SOAP (as an xsd:double) in a number of possible ways,
    ' depending on the field definition.
    ' if the field type is percent, salesforce.com handles the
    ' display of the data by appending a percent sign (%).
    '
    Case "double"
        toVBtype = val(value) ' normal case
       
        ' special case, deal with excel cells formated as percentages,
        ' in general salesforce expects percentages to be doubles > 1.0
        ' and excel stores them as  numbers less than 1, ie: 55% == "0.55" in excel
        If Right(value.NumberFormat, 1) = "%" Then toVBtype = toVBtype * 100
        ' end 5.47
        
    Case Else ' all other types (so far),  work with this "string" type
      toVBtype = "" & value

Perhaps you should try to pass it in quotes?

deepblueseadeepbluesea

Hi efantini,

I have faced similar problems when updating data using the sForce connector, but the issue was resolved when I set my personal language back to "English" (rather than "German") within sfdc. The ##.00 --> ##00.00 conversion points in the same direction, because the decimal dot is not recognized as such.

Please be aware that changing your personal language may also affect field names and even picklist values, though.

Cheers, Erik