I am trying to populate a dropdown with a session variable. I have an xbasic funciton that looks like this.
For Session.cityLookup = result2 the result of the SQL query is two records (for testing) and they show up side by side, no crlf.
Amarillo Ramey
Rather than
Amarillo
Ramey
Any help would be appreciated
Code:
'-----------selects city & state from zip table DIM conn as SQL::Connection DIM cs as c DIM vrcity as c DIM vrstate as c DIM sql as c cs = "::name::lmdevsite1" conn.Open(cs) '---------Checks to see if there is more than one city for the zip sql1 = "SELECT COUNT(5digitCommercial.CityName) FROM 5digitCommercial WHERE 5digitCommercial.CityType IN ('D','A') AND 5digitCommercial.ZIPCode = '" + e._currentRowDataNew.zip1 + "'" conn.Execute(sql1) result1 = conn.ResultSet.ToString() if val(result1) > 1 then sql2 = "SELECT 5digitCommercial.CityName FROM 5digitCommercial WHERE 5digitCommercial.CityType IN ('D','A') AND 5digitCommercial.ZIPCode = '" + e._currentRowDataNew.zip1 + "'" conn.Execute(sql2) result2 = conn.ResultSet.ToString() Session.cityLookup = result2 sql="SELECT 5digitCommercial.CityName,'|',5digitCommercial.StateAbbr,'|',5digitCommercial.ZIPCode FROM 5digitCommercial WHERE 5digitCommercial.CityType = 'D' AND 5digitCommercial.ZIPCode = '" + e._currentRowDataNew.zip1 +"'" conn.Execute(sql) result = conn.ResultSet.ToString() for each x in result vrcity = word(x,1,"|") vrstate = word(x,2,"|") vrzipcode = word(x,3,"|") next x '============For a grid========= ' e._setRow_1.city1.value = alltrim(vrcity) ' e._setRow_1.state1.value = alltrim(vrstate) '============For a UX/Dialoggrid========= ' e.control.city1 = alltrim(vrcity) e.control.state1 = alltrim(vrstate) else sql="SELECT 5digitCommercial.CityName,'|',5digitCommercial.StateAbbr,'|',5digitCommercial.ZIPCode FROM 5digitCommercial WHERE 5digitCommercial.CityType = 'D' AND 5digitCommercial.ZIPCode = '" + e._currentRowDataNew.zip1 +"'" conn.Execute(sql) result = conn.ResultSet.ToString() for each x in result vrcity = word(x,1,"|") vrstate = word(x,2,"|") vrzipcode = word(x,3,"|") next x '============For a grid========= ' e._setRow_1.city1.value = alltrim(vrcity) ' e._setRow_1.state1.value = alltrim(vrstate) '============For a UX/Dialoggrid========= e.control.city1 = alltrim(vrcity) e.control.state1 = alltrim(vrstate) end if
Amarillo Ramey
Rather than
Amarillo
Ramey
Any help would be appreciated