Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Unable to properly convert a value due to decimal precision issue.

(0) ShareShare
ReportReport
Posted on by 139

Hello all, good day. I would like to ask a question, i've been trying to import something into the database via job and I am having issues with some values, here is an example.

1000.002

Here is the line of code within the switch where it is supposed to assign the value:

case COMVariantType::VT_R8  : cellItemId = strFmt(num2Str(cells.item(record, 1).value().double(),0,0,0,0));   break;

Instead of assigning the value of 1000.002 it instead assigns just the value 1000.

What is wrong with my conversion here? 

Thank you.

  • Sean The Michael Profile Picture
    Sean The Michael 139 on at
    RE: Unable to properly convert a value due to decimal precision issue.

    Ah hello thank you for this, but This is not the only record with that issue, there are about a hundred more records that have decimal values. But thank you for your input sir.

    EDIT: It actually worked after some tinkering about. Thank you for your suggestion good sir.

  • kvnkk Profile Picture
    kvnkk 800 on at
    RE: Unable to properly convert a value due to decimal precision issue.

    can you try this ---info(strFmt(num2Str(1000.002,0,3,0,0)));

  • Sean The Michael Profile Picture
    Sean The Michael 139 on at
    RE: Unable to properly convert a value due to decimal precision issue.

    Hello sir Ludwig,

    The item with 3 decimal places is an ItemID provided to us by our user via excel file. My job is supposed to check if the value 1000.003 exists in a table so my job can proceed to write the data associated with that ItemID, but it only returns the value of 1000.

  • Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: Unable to properly convert a value due to decimal precision issue.

    Hi Sean The Michael,

    The first question that I have is why you use 3 decimal places?

    Is this something that you adjusted or a part of a localization package for your country?

    Best regards,

    Ludwig

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans