Hi,
To use the calculated field for this project, you should have knowledges of javascript. For example, if your form includes two drop-down fields for cities, fieldname1 and fieldname2, with values ( A, B, C ) and ( D, E, F ) respectively, and an array of cities and routes, like follow:
var routes = [
{‘from’ : ‘A’, ‘to’ : ‘D’, ‘route’ : 4 },
{‘from’ : ‘A’, ‘to’ : ‘E’, ‘route’ : 6 },
{‘from’ : ‘A’, ‘to’ : ‘F’, ‘route’ : 8 },
{‘from’ : ‘B’, ‘to’ : ‘D’, ‘route’ : 4 },
{‘from’ : ‘B’, ‘to’ : ‘E’, ‘route’ : 6 },
{‘from’ : ‘B’, ‘to’ : ‘F’, ‘route’ : 8 },
{‘from’ : ‘C’, ‘to’ : ‘D’, ‘route’ : 4 },
{‘from’ : ‘C’, ‘to’ : ‘E’, ‘route’ : 6 },
{‘from’ : ‘C’, ‘to’ : ‘F’, ‘route’ : 8 }
];
The equation would be similar to:
(function(){
var routes = [
{‘from’ : ‘A’, ‘to’ : ‘D’, ‘route’ : 4 },
{‘from’ : ‘A’, ‘to’ : ‘E’, ‘route’ : 6 },
{‘from’ : ‘A’, ‘to’ : ‘F’, ‘route’ : 8 },
{‘from’ : ‘B’, ‘to’ : ‘D’, ‘route’ : 4 },
{‘from’ : ‘B’, ‘to’ : ‘E’, ‘route’ : 6 },
{‘from’ : ‘B’, ‘to’ : ‘F’, ‘route’ : 8 },
{‘from’ : ‘C’, ‘to’ : ‘D’, ‘route’ : 4 },
{‘from’ : ‘C’, ‘to’ : ‘E’, ‘route’ : 6 },
{‘from’ : ‘C’, ‘to’ : ‘F’, ‘route’ : 8 }
];
for( var i = 0; i < routes.length; i++ )
{
if( fieldname1 == routes[i][‘from’] && fieldname2 == routes[i][‘to’] )
{
return routes[i][ ‘route’ ];
}
}
return ”;
})()
I hope the demo help you to create your own equation.
Best regards.