Dictionary.HasKey issue on El Capitan with XOJO 2015R4

Hello guys ,

I have i issue with Dictionary.HasKey and i wanted to know if it`s a but and i should fie a but report or something else with the code itself.

So the setup comes like this :

A public Dictionary property then i initialize it in the method :

[code] dim item As String
dim items() As String
SearchDict = New xojo.Core.Dictionary

lbData.DeleteAllRows()

items = RecordData.Split("|") 'recovers the string and it converts the data into an array

SearchDict.RemoveAll

For each item in items
lbData.AddRow(item)
lbData.CellTag(lbData.LastIndex, 1) = DelroundX
SearchDict.Value(item) = “1” 'i just add the value as i need only the value
Next[/code]

So far is ok, i get the 3 values and are ok, then on the other method that is used to populate the listbox i do :

[code] dim query As String
dim contentSet As RecordSet

lbSearchResult.DeleteAllRows()

query = "SELECT name "
query = query + "FROM table "
query = query + "ORDER BY name COLLATE NOCASE asc"

contentSet = App.sqlBase.SQLQuery(query)

If contentSet <> Nil Then
While Not contentSet.EOF

  If SearchDict.HasKey(contentSet.Field("name").textValue) = False Then     'here it finds the first2 but not the last one .
    
    lbSearchResult.AddRow(contentSet.Field("name").textValue)
    
    lbSearchResult.Invalidate
   
  End If
  
  contentSet.MoveNext()
Wend
contentSet.Close()

End If
[/code]

so that code should check if the record in the contentSet it exists in the dictionary then it is not added in the listbox, otherwise it adds it in the listbox,

The idea is to have in the mail listbox only unique records.

If in case it is a bug then please let me know and i`ll file it.

In the first case, you add a string as key to the dictionary. In the second, you use textValue – is that StringValue converted to text? In that case: Have you tried to use only one data type, either string or text?

Addition: There may be some valuable information in this thread.

I ran into the same issues by mixing string and text for the key of the dictionary which wasn’t good. Be aware of!

Additionally, I would check if your column names (fieldNames) in the sql db are all equal and same type/encoding of the keys in the dict.