jkee54
asked on
Running agent from a page
I have an agent that runs on selected documents fine from a view. When the same view is embedded in a page, the same documents are selected and I get the error "document has not yet been saved"
These documents have been saved for a long time. Is there a way to fix this?
These documents have been saved for a long time. Is there a way to fix this?
also run on unprocessed documents. yes...you should be running from a action button from the embedded view.
ASKER
It looks like 'almost' the answer - it doesn't throw any error, opens Excel and does all the preliminary formatting, but doesn't bring in any values. This is the part that doesn't work. The cells are blank in the result.
'Row start
row%=4
Set doc=dc.GetFirstDocument
While Not (doc Is Nothing)
'fill cells with values from Notes
xlsheet.Cells(row%,1).Value=doc.Date(0)
xlsheet.Cells(row%,2).Value=doc.EScore(0)
xlsheet.Cells(row%,3).Value=doc.E1(0)
xlsheet.Cells(row%,4).Value=doc.E2(0)
xlsheet.Cells(row%,5).Value=doc.E3(0)
xlsheet.Cells(row%,6).Value=doc.E4(0)
xlsheet.Cells(row%,7).Value=doc.E5(0)
xlsheet.Cells(row%,8).Value=doc.E6(0)
xlsheet.Cells(row%,9).Value=doc.E7(0)
xlsheet.Cells(row%,11).Value=doc.E8(0)
xlsheet.Cells(row%,11).Value=doc.E9(0)
xlsheet.Cells(row%,12).Value=doc.E10(0)
xlsheet.Cells(row%,13).Value=doc.E11(0)
xlsheet.Cells(row%,14).Value=doc.E12(0)
xlsheet.Cells(row%,14).Value=doc.E13(0)
xlsheet.Cells(row%,15).Value=doc.NewPolicy(0)
Set doc=dc.GetNextDocument(doc)
row%=row%+1
Wend
Try to embed the view in a form, not in a page, and prevent saving documents using that form: add one field with the name SaveOptions, computed, value "0".
ASKER
ok. Here is what I have so far:
Action Bar Button in the view. Works perfect from the view by itself.
Action Bar Button in the veiw when imbedded in either a page OR a form gives "document not saved" error.
Hotspot button on the page. Works perfectly except does not bring in the values from Notes. No error.
Hotspot button on the form. Doesn't work at all.
I didn't post the entire code. In general, it opens Excel, puts in column headers and does formatting like column widths etc, and brings in the code at the end. I don't understand why the same exact code works from the native View but when it's in a Page Hotspot it won't bring the values. Please let me know if the entire code would be helpful, but the piece I posted is the only part that doesn't work in the page.
Action Bar Button in the view. Works perfect from the view by itself.
Action Bar Button in the veiw when imbedded in either a page OR a form gives "document not saved" error.
Hotspot button on the page. Works perfectly except does not bring in the values from Notes. No error.
Hotspot button on the form. Doesn't work at all.
I didn't post the entire code. In general, it opens Excel, puts in column headers and does formatting like column widths etc, and brings in the code at the end. I don't understand why the same exact code works from the native View but when it's in a Page Hotspot it won't bring the values. Please let me know if the entire code would be helpful, but the piece I posted is the only part that doesn't work in the page.
Darn, I had hoped the form would solve the problem...
If a button is clicked from the view, it runs in the view's context. If the view is in a page or form, it runs in the form's context. The button on the form won't work, because it cannot access the embedded view. I suppose that the button on a page won't work for the same reason.
Did you try with the form and the debugger? To see where it gives up?
If a button is clicked from the view, it runs in the view's context. If the view is in a page or form, it runs in the form's context. The button on the form won't work, because it cannot access the embedded view. I suppose that the button on a page won't work for the same reason.
Did you try with the form and the debugger? To see where it gives up?
ASKER
OK, I understand why the hotspot button won't work on the embedded view. But then why doesn't the action bar button that is IN the view that is embedded work? (that's the one that says document not saved).
The debugger doesn't reveal anything when running from the action bar button. The error stops the code right at the beginning and the debugger doesn't even open.
From the hotspot button, the debugger goes to the point where the values should be brought from Notes and seems to jump right over that whole piece (the snipit I pasted here). Then the code finishes without any results in the spreadsheet.
The debugger doesn't reveal anything when running from the action bar button. The error stops the code right at the beginning and the debugger doesn't even open.
From the hotspot button, the debugger goes to the point where the values should be brought from Notes and seems to jump right over that whole piece (the snipit I pasted here). Then the code finishes without any results in the spreadsheet.
ASKER
I know that when I select documents from the page, then open the native view from designer, that the same documents are selected. Can I insert code that 'sends' it to the native view to run through the section of code that gets the values, since it works in the view?
Does that make sense?
Does that make sense?
Weird... I don't have a solution right now.
Here's a page that might help:
http://www-01.ibm.com/support/docview.wss?uid=swg21279380
Here's a page that might help:
http://www-01.ibm.com/support/docview.wss?uid=swg21279380
ASKER
I read the article and it did seem to address the problem. Thier solution was already in my code except that they place the code in an action bar button event of the view. I tried that and still get the 'no document selected' error when running from the page OR a form, and no error when running from the native view.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for taking me as far as you did!
Please try this and let me know how you get on!