• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 394
  • Last Modified:

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?
0
jkee54
Asked:
jkee54
1 Solution
 
shuboarderCommented:
I think in embedded views the lotusscript needs to be in an action button in order for it to work.

Please try this and let me know how you get on!
0
 
madheeswarCommented:
also run on unprocessed documents. yes...you should be running from a action button from the embedded view.
0
 
jkee54Author Commented:
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
	

Open in new window

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Sjef BosmanGroupware ConsultantCommented:
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".
0
 
jkee54Author Commented:
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.
0
 
Sjef BosmanGroupware ConsultantCommented:
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?
0
 
jkee54Author Commented:
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.
0
 
jkee54Author Commented:
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?
0
 
Sjef BosmanGroupware ConsultantCommented:
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
0
 
jkee54Author Commented:
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.


0
 
Sjef BosmanGroupware ConsultantCommented:
It doesn't happen very often that I dislike Notes... but this is just one of those things... One can only hope this "feature" is corrected in some later release.

So sorry I couldn't help you. :-|
0
 
jkee54Author Commented:
Thank you for taking me as far as you did!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now