I am having a difficult time getting a DB2 query to work with a dynamic string as a parameter… I have it set as @IDNUMBER direction in … type string and then the value as a string variable I already have populated idNumber… I pass in thru the query in the where clause = @IDNUMBER but I am getting an error that @IDNUMBER is not valid in the context where it is used !any help appreciated
Hey @hannahscott216
When you are using DB2, you should try use the ? symbol as placeholder for parameters in your SQL queries instead of @IDNUMBER
.
Okay ! I have used <> and @ as placeholder but I will try the ? Symbol ! Thank you !
Can I also pass a list of strings in as a variable by first joining them as a singular string variable.
@hannahscott216
Yes, you can pass a list of strings in UiPath by joining them into a single string variable using String.Join
.
e.g.
listOfStrings = New List(Of String) From {"value1", "value2", "value3"}
joinedString = String.Join(",", listOfStrings.Select(Function(s) "'" & s & "'"))
sqlQuery = "SELECT * FROM your_table WHERE your_column IN (" & joinedString & ")"