Hi,
I have created a function to call Google Maps with address X to address Z, distance is taken from Google Maps and inserted in field: "Travel Distance".
Field: "Travel Distance"
Field Type: Decimal
I would need to calculate travel time based on a value of field: "Travel Distance" and past it in the field: "Travel Time" | Time Data Type
Field: "Travel Time"
Field Type: Time
I would like to add this code on a Page field
Rec."Travel Time" := Rec."Travel Distance"/70 * 1000;
Compiler reports an error:
Microsoft Dynamics NAV Development Environment
Type conversion is not possible because 1 of the operators contains an invalid type. Time := Decimal
OK
Answers
As variant use Duration Field Type for "Travel Time"
Works as expected, but I j
I did it like this It works as expected.
If user types in 70 km, it calculates to 1 hour, if user inserts 210 it calculates to 3 hours, if user inserts 180 it calculates to 2 hour 36 minutes.
Thank you
BR Damjan