• Creator
    Topic
  • #4300
    lp_irovetz
    Participant

    Hi advansys team,

    His there someone could help me ?

    I like to add, in a library, a document and just after open it

    Here a piece of my code (LibTrouv is my library object)



    DocNewNum = LibTrouv.NextDocumentNumber
    msgbox LibTrouv.NextDocumentNumber ‘ =====> 994

    ‘Création du document
    call LibTrouv.documents.Add(Path, “Document”)
    msgbox LibTrouv.NextDocumentNumber ‘ =====> 994 Strange isn’t it ????????

    set DocNew = LibTrouv.getdocument (DocNewNum)



    When i’m alone, i could open my document, OK
    But, if an another gwclient add documents, sometime the first open the second document !!!!

    Is “LibTrouv.NextDocumentNumber” refresh after “LibTrouv.documents.Add” ? and when ?
    Is there a work around ?

    L.P. Irovetz
    ARCANE Groupware

  • Author
    Replies
  • #7762
    lp_irovetz
    Participant

    I found a clue about NextDocumentNumber

    My new code
    ‘—————
    DocNewNum = LibTrouv.NextDocumentNumber
    msgbox LibTrouv.NextDocumentNumber ‘ =====> 994

    ‘Création du document
    call LibTrouv.documents.Add(Path, “Document”)
    call LibTrouv.refresh
    msgbox LibTrouv.NextDocumentNumber ‘ =====> 995 ‘Better

    set DocNew = LibTrouv.getdocument (DocNewNum)

    ‘—————
    How to be sure that DocNewNum is the right one.
    If some another client add a document between DocNewNum and .add ?

    L.P. Irovetz
    ARCANE Groupware[/QUOTE]

    #7763
    lp_irovetz
    Participant

    Thanks to Michael Risch from Novell Forum

    >>Documents.add returns a document object for the newly created object.
    >>That object has a document number property, and you can go with that.

    >>Indeed, you don’t even need the getdocument call if you just work with
    >>the document that is returned by documents.add.

    It runs
    Smile

    L.P. Irovetz
    ARCANE GroupWare

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.