Create a chrono number for all users in a database

I have a database reservation, i have a problem with my chrono number because it is a chrono generated for each user or i would like to have a chrono general for all users , the problem appears because the users don’t see the reservation of other users, so it is a chrono by user … … and there are some double …

This is the code .

Can you modify this to have a chono general for all users, it is refer to view specific Numéro de chrono… i hope you are understand me , if you want i can send you the database to see my problem.

Can you help me , it is urgent

ThanKs for us .

Sub Initialize

Dim session As New NotesSession

Dim workspace As New NotesUIWorkspace

Dim db As NotesDatabase

Dim view As NotesView

Dim vc As NotesViewEntryCollection

Dim source As NotesUIDocument

Dim doc As NotesDocument

'permet de récupérer la valeur d’un champ sur un doc

Dim item As NotesItem

Dim compteur As Long

compteur = 0



Set source = workspace.CurrentDocument

Set db = session.CurrentDatabase

ID = source.FieldGetText("NumID")

'On regarde la vue “Numéro de chrono”

Set view = db.GetView("Numéro de chrono")

Set vc = view.AllEntries

If vc.count=0 Then

'Nombre de départ du compteur

	compteur="0000"

Else

'On cherche le dernier doc de la vue “Numéro chrono” et on récupère son compteur

	Set doc = view.getFirstDocument()

	unid$ = doc.UniversalID

	If unid$=ID Then

		Set doc = view.getNextDocument(doc)

	End If

	Set item = doc.GetFirstItem("ID")

	Forall n In item.Values

		it = n

		Print n

	End Forall

'Si l’item est égal à 0, alors, incrémenté le compteur et regarder le prédécesseur

	While it="0000"

		

		compteur=compteur+1

		Set doc = view.getNextDocument(doc)

		Set item = doc.GetFirstItem("ID")

		Forall n In item.Values

			it = n

			Print n

		End Forall

	Wend

	'compteur = compteur+Cint(it)

	compteur = compteur+ (it)		

	

End If

'On assigne la valeur compteur au champ ID

'Call source.FieldSetText("ID",Cstr(compteur+1))



Call source.FieldSetText("ID", Format$(Cstr(compteur+1),"0000"))	



Call source.save

Subject: create a chrono number for all users in a database

The other main way to do this is to have a single document (note: NOT a profile document as this is cached) with the next number in a single field that you increment. Becareful of document locking/replication or save conflict issues though…

Subject: RE: create a chrono number for all users in a database

The problem is when it get to the view numéro chrono , with the id of the person , he found anly the documents they are created … greeee …

if it possible to say . i open the view numéro chrono with th id admin , also he xwill see all the doucumets and the chrono number will be general … you understand i say . so in fact …

How to db.GetView(“adminview”) with the id admin (for application ) for example admin.id … it is a big challenge i ask you … please me give me the response …

how can i write it to do :

open with id=admin.id ??? this view

Set view = db.GetView(“adminview”)

'Set vc = view.AllEntries