<%@ LANGUAGE="VBScript" %> <% 'This page is invoked when the user clicks on the population distribution map 'contained in Index.asp. From there, we pass the internal id of the state and the 'SWF name of the map which represents that state. 'Here, we show more details on that particular state. %> FusionMaps v3 - Database Example <% 'You need to include the following JS file to embed the map using JavaScript 'Embedding using JavaScripts avoids the "Click to Activate..." issue in Internet Explorer 'When you make your own maps, make sure that the path to this JS file is correct. Else, you would get JavaScript errors. %>
 
State-wise employment distribution
Click on a region to see more details.
<< Click here to go back to US Map
<% 'Variables to store XML Data 'strXML will be used to store the entire XML document generated dim strXML 'strXML will be used to store the entire XML document generated 'Generate the chart element strXML = strXML & "" strXML = strXML & "" strXML = strXML & "" strXML = strXML & "" strXML = strXML & "" strXML = strXML & "" strXML = strXML & "" 'Start the element strXML = strXML & "" 'Fetch all entity records strQuery ="select a.Internal_Id,a.entity_id,sum(data) as datap from fcmap_distribution a group by a.Internal_Id,a.entity_id having a.Internal_Id='" & request("Internal_Id") & "'" set rs = Server.CreateObject("ADODB.Recordset") rs.open strQuery,oConn 'If we've records to iterate, proceed if rs.bof=false then do while not rs.eof 'Get details for the region strQuery ="select a.Internal_Id,a.entity_id,b.group_name,sum(data) as datap from fcmap_distribution a, fcmap_group_master b where b.group_id=a.group_id group by a.Internal_Id ,a.entity_id, b.group_name having a.Internal_Id='" & rs("Internal_Id") & "' and entity_id='" & rs("entity_id") & "'" set rs2 = Server.CreateObject("ADODB.Recordset") rs2.open strQuery,oConn 'We'll create out custom tool text for each entity. So, create a place holder. tooltext="" 'Total counter totEmp=0 dim StateValue,TotalStateValue,StatePer StateValue=0: TotalStateValue=0: StatePer=0 do while not rs2.eof ' Calucation value StateValue=cdbl(rs2("datap")) TotalStateValue=cdbl(rs("datap")) 'Get percentage of employment StatePer=round((StateValue / TotalStateValue) * 100,2) 'Add to tool text tooltext = tooltext & rs2("group_name") & ":" & StatePer & "%25 \n" 'If it's not unemployed group if rs2("group_name") <> "Unemployed" then totEmp = totEmp + StatePer end if rs2.movenext loop 'Generate 'Also append link to Charts.asp passing all required information (from querystring) and the database 'We also add our custom tool text strXML = strXML & "" rs.movenext loop end if 'Finally, close element strXML = strXML & "" strXML = strXML & "