hi experts,

i've a parent form, frmIn and a response form, frmCheckOut.
i've set at the frmCheckOut to change the value of the field 'Status', from 'Available' to 'Check Out' in the frmIn.

i use the formula @SetDocField( $Ref;  "Status"; "Check Out" ) in the input translation of the Status field in frmCheckOut.

My problem is after i've deleted the response document, the Status in frmIn is still 'Check Out'. how do i change it back to 'Available'?

my main purpose is to set the field 'Status' to 'Check Out' if it has a response document; and set it to 'Available' if it doesn't have one.

please help. thank you very much.

Who is Participating?
HemanthaKumarConnect With a Mentor Commented:
Web !!!

It will not work on web, just notes client.

How do you delete the document in web ? Do you use any script ? If so why don't you update the parent while deleting.

ZvonkoSystems architectCommented:
When do you need this "Status" field to be showing the correct state?
Do you need it in the view?
Or do you need it when opening "frmIn" document?

When you delete the response, QueryDocumentDelete is executed. Copy and paste this script in your Database Script

Function ChangeState(Source As NotesUIDatabase, Stat As String)
     Dim col As NotesDocumentCollection, doc As NotesDocument, pdoc As NotesDocument
     Dim db As NotesDatabase    
     Set db = Source.Database
     Set col = Source.Documents
     Set doc = col.GetFirstDocument
     While Not doc Is Nothing
          If doc.Form(0) = "Response" Then
               Set pdoc = db.GetDocumentByUNID(doc.ParentDocumentUNID)
               If Not pdoc Is Nothing Then
                    pdoc.Status = Stat
                    pdoc.save True, False
                    Msgbox "No parent document available"
               End If
          End If          
          Set doc = col.GetNextDocument(doc)
End Function

Sub Querydocumentdelete(Source As Notesuidatabase, Continue As Variant)
     Call ChangeState(Source, "Available")
End Sub

Sub Querydocumentundelete(Source As Notesuidatabase, Continue As Variant)
     Call ChangeState(Source, "Check Out")
End Sub

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

janelowAuthor Commented:

sorie, there are still a lot of terms i'm still not familiar with. Database script means library script in the database, is it?

janelowAuthor Commented:

i need the Status value in the view and also in the frmIn document. is there a difference? i thought the view will display the value from the frmIn anyhow.

thanx for your reply.
In the designer, You will see resources under that section select Other link. In the workpane you will see database script. Double click that.

This is all for 40 pts ???
janelowAuthor Commented:
sorry. the script didn't work.

the application i'm building is for the web.
i use @Command([MoveTotrash]) and @Command([EmptyTrash]) to delete the document in applet view. would this make any difference?
janelowAuthor Commented:
sorry, i still haven't found the solution to this problem which is the only problem left in my system. i hope any experts will help me out. tq very much.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.