Link to home
Start Free TrialLog in
Avatar of Abdelhamid
Abdelhamid

asked on

why the agent make the copy to folder not work?

dear experts,
hello
I have a shared action the code in it is:
@Command([Folder];"FldMark";"0");
@Command([ToolsRunMacro];"markInView")

but the copying to folder doesn't work.. but if I remove the line of calling the agent @Command([ToolsRunMacro];"markInView")
the copying works ....why this?

can u help me?

thanks
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

For R6 you can try:
@Command([FolderDocuments];"FldMark";"0");
@Command([ToolsRunMacro];"markInView")


For R5 you can try:
@Command([Folder];"FldMark";"0");
@PostedCommand([ToolsRunMacro];"markInView")

Good luck,
Zvonko

Does the agent reverse the move somehow? Does it handle the same document in any way? Using a save?
When is the action triggered (view, doc in read/edit mode)?

You could also experiment with @AddToFolder..... Can't imagine much of a difference, but untill I know more it's worth a try.
Avatar of Abdelhamid
Abdelhamid

ASKER

hello,
I'm in R6
I tested folderDocuments @command but it is the same
also I tested @AddToFolder and no copy

the agent doesn't move the docs, and the agent only get a field from the 1rst doc and the action triggered on selected docs in the view

Abdelhamid

note: I do that from the web
I found some info in R5 designer help (haven't got R6 around here):

Folder
The Folder @command copies or moves selected documents from a view or folder to a folder. The first example below is a copy, the second a move.
@Command([Folder]; "Favorite Stuff"; "0")
@Command([Folder]; "Archive"; "1")
This @command works on the Web only if "Use applet in the browser" is in effect for the implementing view or folder.

I think that last line could explain the problem....
Disregard that.... if it works without the [ToolsRunMacro] you must have set that part right already.
yes it works only if @command([Folder];"FldMark";"0")
but when I put any command it doesn't work ... why?
yes "Use applet in the browser" is in effect
What is the code for agent markInView?

Where is this action used?  View with multiple documents chcked, view with single document checked, view with no documents checked but a document is highlighted?  A new document form, and existing document open in edit mode, an existing document opened in read mode?
this action used in view on the web
multible document checked and they are copyed to folder and the agent run on the documents in the folder
I tried it too (R5): same result.
Haven't found a way around it yet.... Even a simple agent like:
  myVar:="Dummy";
  @Success
prevents it from getting added in the folder (can't use "move" in my test-db)
Have the agent itself place the document in the folder.
hello, qwaletee
how I do that on the web agent?
Lotus does not make this easy!  You would think that you could do it just like the Notes client.  Create an agent that runs on selected documents.  Put in an action that says @COmmand([ToolsRunMacro]; "Your ganet"), and done.

But no.  All web agents must be Run Once/No Target.  And if you set it up that way -- doesn't do anything, because it has no access to the item list.

There is a way though. This is much easier if you DO NOT use the view applet.  I'll describe how for when you use HTML views, instead of the applet.

Create a SHARED test agent.  Call it ContextContent and set it ti Run Once.  Here is its Initialize code:

Dim s as New NotesSession
Dim doc as NotesDocument
Set doc = s.DocumentContext
Forall item in doc.Items
  Print item.name "=" item.text
End Forall

In your view, check off the option to allow HTML selection (reqires R5.0.5 or later).

On your view template form, set the view to use HTML.  Add the following pass-thru HTML at the bottom:

<INPUT TYPE="BUTTON" VALUE="AGENT" onClick = '
document.forms[0].action = "/yourdatabase.nsf/ContextContent";
document.forms[0].submit();
'>

Now, display the view in the web browser.  You should see check boxes next to each row, and a button at the bottom that says AGENT.  Check off two documents and click the button.  You should see something like this:

HTTP_ACCEPT=image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/msword, application/x-shockwave-flash, */*
HTTP_WEFERER=AOBUZXUWLSZLKBRNVWWCUFPEGAUTFJMVRESKPNKMBIPBARHDMNNSKVFVWR
HTTP_ACCEPT_LANGUAGE=en-us
...
...
...
REQUEST_CONTENT=__Click=0&%24%24SelectDoc=0EBFCB5C7F985A6885256C9F0005546A&%24%24SelectDoc=9BC0A8F4CBD69D9585256C9F0005546C

Now, if you decode the request content, you will see that it actually says REQUEST_CONTENT=__Click=0&$$SelectDoc=0EBFCB5C7F985A6885256C9F0005546A&$$SelectDoc=9BC0A8F4CBD69D9585256C9F0005546C

So, your agent could parse out the REQUEST_CONTENT field.  Add an & to the end for easier processing, then keep searching for %24%24SelectDoc=, taking the next 32 characters, getDocumentByUNID with that string, process it, and find the next valeu in the string to process.

Processing for each would consist of adding the document to the folder.  You would also do whatever else your existing agent does.  You might also need to print a [/url...] string at the end to redirect the user to the proper result page.

Now, what if you want to do it with the applet?

That's harder.  Yo would have to have a hidden field on your document -- say, $$SelectDoc :) -- and use the applet API to find which items were selected, and transfer their UNIDs to the hidden field with comma separation, then do the submit. The agent would parse a little differently.  That's it.

But I would recommend sticking with the non-aplet display.
thanks alot for your great help but I should have to use applet view
ASKER CERTIFIED SOLUTION
Avatar of qwaletee
qwaletee

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I tested this code but I have an error when run this line in the code
document.forms[0].submit()

why this happen?
but when I removed it it's work
this code help me  to solve another problem in select documents from applet view
so I will accept this comment
but I still don't know why calling the agent make the copying to the folder doesn't work?
thanks
Not sure why the submit caused an error... but it would seem to work if it actually submitetd it.  COuld be something odd on your view template
I know why cuz I run this code in action
thanks
hi qwaletee
when we check one document I can retreive the UNID of it but if the user does not check the retreiving UNID is the 1rst document
can u tell me how I can know the defference between the document that was checked and the document that was not check?
thanks for your help...
Abdelhamid,

Please ask this in a separate question.  Your original question has long since been answered.
ok...
i'll do