Hi people,
I've recently tried to call the method "GetNextID" on a DialogNextID object using a script. It seems that calling this method does not affect the loaded DialogNextID object. I was wondering if anyone else ran into this problem in 8.0.1.
My script below tries to set a DialogNextID to a specific NextNumber throught the object layer (I am ware the same can be achieved through SQL, but why should the callmethod not work in this instance?)
Has anyone else tried to use the NextID method already? Thanks for your feedback!
Public Sub CCC_Set_StartingCount_GlobalID(ByVal globalIDCount As Integer, Optional ByVal resetCounter As Boolean = False)
' Get or create GlobalID Counter
Dim f As ISqlFormatter = Session.SqlFormatter
Dim globalID As IEntity = Nothing
If Not Session.Source.TryGet(Query.From("DialogNextID") _
.Where(f.Comparison("Ident_DialogNextID", "GlobalID", ValType.String)) _
.GetQuery, globalID) _
Then
globalID = Session.Source.CreateNew("DialogNextID")
globalID.PutValue("Ident_DialogNextID", "GlobalID")
globalID.Save(Session)
End If
If Not resetCounter Then
' Set GlobalID counter to appropriate count
If CInt(globalID.GetValue("NextNumber")) < globalIDCount Then
While Not CInt(globalID.GetValue("NextNumber")) = globalIDCount
Debug.WriteLine(CStr(globalID.GetValue("NextNumber")))
End While
End If
Else
' Reset GlobalID Counter
CCC_Run_SQLWithResult(String.Format("UPDATE DialogNextID SET NextNumber = 0 WHERE {0}",
f.UidComparison("UID_DialogNextID", globalID.GetValue("UID_DialogNextID"))))
End If
End Sub