Sub btnLog_Click
Dim j As Int
If XSelections.IsSelected = False Then
Log("Nothing is selected")
Else
Dim sb As StringBuilder
sb.Initialize
sb.Append("'")
For Each rowid As Long In XSelections.SelectedLines.Keys
Dim row As Map=B4XTable1.GetRow(rowid)
sb.Append(row.Get("Name")).Append("','")
j=j+1
Next
Dim s As String = (sb.ToString)
s= s.SubString2(0, s.LastIndexOf(",'")) 'remove the last 2 characters
s=$"${QUOTE}${s}${QUOTE}"$ 'add double quote
Log(s) 'will display: "'Name1','Name2'"" as one string
End If
End Sub