def get_average_measurement_for_location(location_id):

    crs_two = db_access.get_location_by_id(location_id)    
    averageValue = 0.0
    total = 0.0
    item = 0.0
    
    measurementsForSelectedLocation = db_access.get_measurements_for_location(location_id)
    
    for i in measurementsForSelectedLocation:
        total += float(i['value'])
        item +=1
    
    if item == 0:
        return None
    else:
        averageValue = total/item
        return averageValue
			''')
	
	print('''
		<div style="text-align: center;">
		<input type="submit" value="formAreaID"/>
		</body>
		</html>
		''')	
		
# ------------------------------------| start |----------------------------------------------
form = cgi.FieldStorage()
	
try:
	formLocationID = form.getvalue('location_id')

	if not db_access.get_location_by_id(formLocationID):	
		printErrorMSG(str(formLocationID))

			
# ------------------------------------| good data received |----------------------------------------------	
	else:
		selectedLocation = db_access.get_location_by_id(formLocationID)
		measurementsForSelectedLocation = db_access.get_measurements_for_location(formLocationID)

		# ------------------------------------| HTML Page start |------------------------------------
		print(KJM_HTML_Utility.htmlHeader("Selected Location"))
		print('''
		<body>
		''')
		
		for i in selectedLocation: