luke2012 Well-Known Member Licensed User Longtime User Jun 28, 2016 #1 The Good @Erel I confirm you that I'm following your suggestion and I'm using a UUID for each new item putted in to the Cloud (works very well). This UUID solve the problem of data updated by multiple clients at the same time (as you suggested) and I can have an solid unique item id. The problem: My problem now is that I can't display that UUID (very very long and impossible to remember) to the end user in order to let him identify the item within an item list and probably I need a progressive number to display to user within the App (ex. item n.1, item n.2 etc...). Some custom item have a item name different from each item within the item list that I show within the app, but there are some custom items that doesn't have a name, but also some data (numeric data for example) but the end user cannot identify items because there haven't name or number (he can't see item n. 1 etc). Any Idea? Thanks in advance for your precious help.
The Good @Erel I confirm you that I'm following your suggestion and I'm using a UUID for each new item putted in to the Cloud (works very well). This UUID solve the problem of data updated by multiple clients at the same time (as you suggested) and I can have an solid unique item id. The problem: My problem now is that I can't display that UUID (very very long and impossible to remember) to the end user in order to let him identify the item within an item list and probably I need a progressive number to display to user within the App (ex. item n.1, item n.2 etc...). Some custom item have a item name different from each item within the item list that I show within the app, but there are some custom items that doesn't have a name, but also some data (numeric data for example) but the end user cannot identify items because there haven't name or number (he can't see item n. 1 etc). Any Idea? Thanks in advance for your precious help.
luke2012 Well-Known Member Licensed User Longtime User Jun 28, 2016 #2 @Informatix suggest to compute the long UUID string to an hash code (The solution to get a long from a string is to compute a hash) : Code: Sub HashCode(s As String) As Long Dim h As Long = 0 For i = 0 To s.Length - 1 h = 151 * h + (Asc(s.CharAt(i)) - 32) Next Return h End Sub Upvote 0
@Informatix suggest to compute the long UUID string to an hash code (The solution to get a long from a string is to compute a hash) : Code: Sub HashCode(s As String) As Long Dim h As Long = 0 For i = 0 To s.Length - 1 h = 151 * h + (Asc(s.CharAt(i)) - 32) Next Return h End Sub
Erel B4X founder Staff member Licensed User Longtime User Jun 28, 2016 #3 Hashes are not unique. Two UUIDs can have the same hashcode. Why don't you add another field with a friendly name? Don't show the UUIDs at all. Upvote 0
Hashes are not unique. Two UUIDs can have the same hashcode. Why don't you add another field with a friendly name? Don't show the UUIDs at all.