adding a (python) list to project suite variable from database
Hi All, Am trying to fetch the values from database which am able to do now after fetching, I want to add those values as a list in to single project suite variablebut here its storing only the last loop variable. And if when there is space like in between South East ,from DB it is unable to fetch the particular value I tried concatenation every thing but its not working. area of i in the below code contains = North, South, East , South East , West. def dbarea(): for i in range(0,5): area = ProjectSuite.Variables.Location #DBquery =ProjectSuite.Variables.Deal_DBQuery area = area.split(",") Log.Message(str(area[i])) AConnection = ADO.CreateADOConnection() # Specify the connection string AConnection.ConnectionString = "Provider=MSDASQL.1;" + \ "Data Source=LMk2 Penelope"; #AConnection.ConnectionString = "Provider=MSDASQL.1;" + \ #"Data Source=itvuat"; AConnection.LoginPrompt = False AConnection.Open() #Log.Message((area[i])) # Execute a simple query RecSet = AConnection.Execute_('select sare_no from sare where short_name='+str(area[i])) RecSet.MoveFirst(); data_container = [] r= [] while not RecSet.EOF: # rows1 = "" rows = RecSet.Fields.Item["Sare_no"].Value data_container.append(rows) # rows = rows.append(",") #rows.split(",") #Log.Message(rows) RecSet.MoveNext() AConnection.Close() Log.Message(str(data_container)) dbcount = len(data_container) Log.Message("The Database Count is :"+str(dbcount)) ProjectSuite.Variables.AddVariable("Var5","String") ProjectSuite.Variables.Var5 = str(data_container) Log.Message(ProjectSuite.Variables.Var5) Kindly let me know any suggestionsSolved4.1KViews0likes9Comments