December 22, 201015 yr Newbies I am working on a database that I need to sync with FM Go, and a copy will occasionally be offline. I want to use ScriptMaster for the UUID function, but obviously FM Go does not support extensions. I want to be able to use a custom function which will create a result consistent with the Scriptmaster UUID function and also not create duplicates. I know that there are various custom functions at Brian Dunning et al which will create a UUID, but I would like to know if it will be consistent (e.g. if I incorporate offline records can I be reasonably sure that none will have a duplicate UUID even if it is created at the exact same time as another record created on the primary system). Any suggestions? Thanks, Dr D.
December 23, 201015 yr There is also Ray Cologon's uID technique: Link But the use of uIDs is not synching. It just allows for new records to not clash on import. How will you handle an offline user's edit of a record that an office user has also edited? Basically, this is a big topic.
December 24, 201015 yr Author Newbies Bcooney, I appreciate your reply. I probably used the term "sync" too loosely; I mainly am concerned with what you are describing, the import of external/offline records into a main database. I had considered Ray Cologon's solution, but I would like to use more conventional UUID generation to be more consistent with other systems, just in case. I am curious if anyone knows which among the various UID generation schemes (custom functions) is most similar to the ScriptMaster format. I'm not asking for anyone to divulge any trade secrets, just asking if it's possible. I am considering using ScriptMaster for its UUID function because I unfortunately have multiple tables in multiple files, and it's a pain to have to import a custom function or functions that many times. I realize I will have to do some of that anyway to support FM Go, but I want to limit it to what's necessary. Thanks again, Dr D
December 24, 201015 yr take a look at this file? http://fmforums.com/topic/73890-unique-serial-number-generator/
December 24, 201015 yr Dr. D. I believe you wish to have the UUID to be in the same 'format' so that you have a consistent 36 digit UUID? Such as : c4a5be79-54aa-1ed6-d181-c5dc981fce3a 0a62a43f-af7e-48a6-8359-e94f3c6fde0b The first one is generated by the function below - The second one is generated by ScriptMaster Groovy UUID Let ( [ hexVals = "0123456789abcdef"; d1 = GetAsNumber(Get(CurrentHostTimeStamp)); d2 = Div (d1; 16); d3 = Div (d2; 16); d4 = Div (d3; 16); d5 = Div (d4; 16); d6 = Div (d5; 16); d7 = Div (d6; 16); d8 = Div (d7; 16) ]; Middle(hexVals; Mod (d8; 16) + 1; 1) & Middle(hexVals; Mod (d7; 16) + 1; 1) & Middle(hexVals; Mod (d6; 16) + 1; 1) & Middle(hexVals; Mod (d5; 16) + 1; 1) & Middle(hexVals; Mod (d4; 16) + 1; 1) & Middle(hexVals; Mod (d3; 16) + 1; 1) & Middle(hexVals; Mod (d2; 16) + 1; 1) & Middle(hexVals; Mod (d1; 16) + 1; 1) & "-" & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & "-" & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & "-" & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1)& "-" & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) )
December 24, 201015 yr UUIDTesting.fp7.zip Here is a file that you can see for your self - a script will create 50k records, I have yet to ever get a duplicate.
December 27, 201015 yr Author Newbies Stephen, Thanks so much for your recommendations; these seem to be exactly what I am looking for. I will try these and let you know how this works in/with FM Go. Thanks again, Dr D
December 27, 201015 yr Stephen I assume the SM uses java classes to create a type 4 UUID so to be an exact match for the format surely the code should be Let ( [ hexVals = "0123456789abcdef"; yVals = "89ab"; d1 = GetAsNumber(Get(CurrentHostTimeStamp)); d2 = Div (d1; 16); d3 = Div (d2; 16); d4 = Div (d3; 16); d5 = Div (d4; 16); d6 = Div (d5; 16); d7 = Div (d6; 16); d8 = Div (d7; 16) ]; Middle(hexVals; Mod (d8; 16) + 1; 1) & Middle(hexVals; Mod (d7; 16) + 1; 1) & Middle(hexVals; Mod (d6; 16) + 1; 1) & Middle(hexVals; Mod (d5; 16) + 1; 1) & Middle(hexVals; Mod (d4; 16) + 1; 1) & Middle(hexVals; Mod (d3; 16) + 1; 1) & Middle(hexVals; Mod (d2; 16) + 1; 1) & Middle(hexVals; Mod (d1; 16) + 1; 1) & "-" & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & "-" & "4" & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & "-" & Middle(yVals; Int(Random*4)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1)& "-" & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) & Middle(hexVals; Int(Random*16)+1; 1) )
December 30, 201015 yr Stephen I assume the SM uses java classes to create a type 4 UUID so to be an exact match for the format surely the code should be... Almost. The calculation should use random numbers in place of the timestamp, too.
Create an account or sign in to comment