Convert Int to a decimal number

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
KrisJeff
Flowcode v5 User
Posts: 25
Joined: Sun Feb 01, 2009 5:32 pm
Location: Albox, Almeria, Spain.
Has thanked: 4 times
Contact:

Convert Int to a decimal number

Post by KrisJeff »

Can someone help with the attached. I want to be able to print an amps value in decimal to 2 decimal places?
Attachments
ADC_Int_3Expiriment.fcfx
(9.76 KiB) Downloaded 126 times

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Convert Int to a decimal number

Post by mnf »

In a calculation use:

str = FloatToString$(value, 2) (or change 2 to required number of digits...)

Then print str.. (str defined a string variable..)

Martin

KrisJeff
Flowcode v5 User
Posts: 25
Joined: Sun Feb 01, 2009 5:32 pm
Location: Albox, Almeria, Spain.
Has thanked: 4 times
Contact:

Re: Convert Int to a decimal number

Post by KrisJeff »

Dear Martin,
Thank you for your help to date. Done as instructed. Now get to 2 decimal places but still printing only the whole number.
Sorry, I'm not very good with string manipulations etc. Please see amended as per attached.
Attachments
ADC_Int_3Expiriment.fcfx
(10.16 KiB) Downloaded 112 times

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Convert Int to a decimal number

Post by mnf »

Sorry - not at computer now.. but is your value a float?

Just looked and it's an integer value - you'll need a floating point value for your result...

Martin

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Convert Int to a decimal number

Post by medelec35 »

Martin is correct.
I have change it for you.
Try the attached Flowchart.
Attachments
ADC_Int_3Expiriment2.fcfx
(11.09 KiB) Downloaded 132 times
Martin

Post Reply