Conning
(Conning)
July 13, 2023, 1:10am
1
Hi guys im trying to make a basic bmi calculator but I am getting these errors
1st error
When I tried to type in my height in meter (1.8m) on the input dialog, the output shows "Input Dialog: 1.8 is not a valid value for Int32 (Parameter value)
2nd error
When I use assign to save the value of Weight / Height * Height, the error were showing "BC30512: Option Strict On disallows implicit conversions from ‘Double’ to ‘Integer’. The selected value is incompatible with the property type
How can I fix this problem?
PS: All of my variable type for (IntWeight, IntHeight and IntResult are Int32)
mkankatala
(Mahesh Kankatala)
July 13, 2023, 3:44am
2
Hi @Conning
1.8 is not an integer it was a decimal you have to change the storing of input value in a variable to double.
Change the int_Height variable type to double then you are able to store the decimals. The double datatype supports integer and decimals too.
Hope it helps!!
1 Like
supriya117
(Supriya Allada)
July 13, 2023, 4:03am
3
Hi @Conning
If you want to give input as double as variable instead of integer type including output variable also.
System.Double
1 Like
lrtetala
(Lakshman Reddy)
July 13, 2023, 4:10am
4
Hi @Conning
Try this
(CInt(Weight)/CInt(Height))*CInt(Height)
Variable types must be below
I hope it helps!!
1 Like
Conning
(Conning)
July 13, 2023, 6:02am
5
Thank you all for your responses!
lrtetala
(Lakshman Reddy)
July 13, 2023, 6:06am
6
@Conning
If you got the solution please mark as solution
1 Like
mkankatala
(Mahesh Kankatala)
July 13, 2023, 6:06am
7
Welcome @Conning
If you find the solution, please do mark as solution to close the loop
Happy Automation!!
1 Like
Conning
(Conning)
July 13, 2023, 6:07am
8
Hi! I have tried using your method but the BMI I got was from the weight(67)
Is there anything else that I need to change?
Thanks for helping!
lrtetala
(Lakshman Reddy)
July 13, 2023, 6:11am
9
@Conning
Ex:60/5.6 * 5.6 so height will be cancel the result will be 60
I think your formula will be (weight/(height*Weight))
1 Like
vrdabberu
(Varunraj)
July 13, 2023, 6:11am
10
@Conning
When you use the below formula
(Weight/Height)*Height
You will get the weight only so please check the formula
Use the below formula instead of that
Weight/(Height*Height)
mention the height in metres
Regards
1 Like
mkankatala
(Mahesh Kankatala)
July 13, 2023, 6:14am
11
You are giving the wrong syntex below
give like this
The formula for BMI is weight/height square you have to encapsulate height*height in curve brackets
Cint(Weight)/(Cint(Height)*Cint(Height))
1 Like
Hi @Conning
Input Dialog (Title: “Enter Height in Meters”, Output: strHeight)
IntHeight = Convert.ToInt32(Double.Parse(strHeight))
DoubleResult = Weight / (IntHeight * IntHeight)
Input Dialog (Title: “Enter Height in Meters”, Output: strHeight)
Assign - IntHeight = Convert.ToInt32(Double.Parse(strHeight))
Input Dialog (Title: “Enter Weight in Kilograms”, Output: strWeight)
Assign - IntWeight = Convert.ToInt32(Double.Parse(strWeight))
Assign - DoubleResult = IntWeight / (IntHeight * IntHeight)
Log Message (Message: "Your BMI is " + DoubleResult.ToString())
Hope it helps!!
1 Like
lrtetala
(Lakshman Reddy)
July 13, 2023, 12:13pm
14
@Conning
If you find the solution mark as solution
mkankatala
(Mahesh Kankatala)
July 13, 2023, 12:13pm
15
@Conning If you find the solution for your query do mark as solution to close the loop
Happy Automation!!
system
(system)
Closed
July 16, 2023, 12:13pm
16
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.