$$ViewTemplateDefault, WebQueryOpen and Open a URL

I have an application with a $$ViewTemplateDefault. This form has a WebQueryOpen agent that is supposed to open a particular view based on some criteria in the agent. Everything works fine except I can’t get it to open a view other than the one defined in the embedded view in the form. (I’ve verified that the agent kicks off and executes everything OK except for the part that opens the view).

In other words, my embedded view is set to display the “SingleStore” view. However, my WebQueryOpen contains this line: Print “[/MultipleStore?OpenView]” (I’ve also tried Print “”)

No matter what I do, it always opens to the SingleStore view that is defined in the $$ViewDefaultTemplate.

I’m sure this is a simple thing. What am I doing wrong? How can I override that default and open the view I want with my WebQuerySave?

Any help is appreciated.

Subject: $$ViewTemplateDefault, WebQueryOpen and Open a URL

Are you saying that you want to use a WQO-agent to redirect to another URL? Not sure that is possible. The ‘normal’ way to use a WQO-agent is to manipulate the current document being opened, nothing else.

Why aren’t you opening an agent using the standard ?openagent command and redirect from there?

Subject: RE: $$ViewTemplateDefault, WebQueryOpen and Open a URL

What I’m trying to do is:

If an admistrator type person opens the database it should open to the MultipleStore view.

If a ‘regular’ person opens the database it should get that person’s name, find all the documents that they need to see, put those documents into a folder and open that folder.

I’ve been struggling for a few days to find a way to do this. Single Category views won’t work due to the structure of my view/folders. I cannot have them categorized. This seemed like a quick and easy approach. The WebQueryOpen gets the username, finds the documents and puts them into the folder. Now all I need to do is find a way to open the right folder.

Am I going about this wrong? I’m pretty new to developing Notes apps for the web and I’m struggling with this one.

Subject: RE: $$ViewTemplateDefault, WebQueryOpen and Open a URL

As I said, just use the ?openagent command to open the agent.Let the agent do it’s job to evaluate the user and put documents where they belong.

Then finish off with a Print-statement containing the ?openview command for the folder.

A WQO-agent can’t (I think) redirect at all, only manipulate content.

As for ‘quick and easy’, the LotusScript PutInFolder method is one of the heaviest operations around and will take a looong time if there are lots of documents to shuffle.

Subject: RE: $$ViewTemplateDefault, WebQueryOpen and Open a URL

How are you defining “An administrator type person”? Here’s what I do for such applications

I have a page pgLauncher with the following code:

Loading the Open Projects… Please be patient…

(this one is just there for looks and is the same as below… .can be left out)


is:

x := @Implode(@UserRoles);

y := @Trim(@ReplaceSubstring(x;“$$WebClient”; “”));

"var y = " + “"” + y + “"”

//The example used here only has one possible role. If you have other roles that you need to filter, you can make y an array instead and loop through the array in the onload event.


in the onLoad event, I place the code:

//Check the user role. If it is Admin, open the openview, else open openbyrequestor

if(y==“[Admin]”){

window.location.replace(‘/projectdeploymentjp.nsf/open?openview’)

}else{

window.location.replace(‘/projectdeploymentjp.nsf/openbyrequestor?openview’)

}

Finally, in my db launch properties, I simply launch the page pgLauncher.

Any conditionals can be done in this manner. UserName can be used instead of roles, or a check to see what groups the user is in could be used. It avoids the whole agent thing completely and runs very quickly. The only catch is that javascript has to be enabled in your environment.

I have run this code in both IE 6 and FF 1.5 and above.

For the “regular people”, you could code the wqo agent into the form that contains the embedded view. This way, they load the view and run the agent, which handles the rest, OR, if you are really just looking for display options, for the “regular people” don’t use a view at all, have the launcher page run an agent via url (instead of opening a view) that builds the html links and prints them back to the browser. I would run this as an AJAX style agent and place the returned html inside a div or span on the launcher page.

Subject: RE: $$ViewTemplateDefault, WebQueryOpen and Open a URL

Thanks for the info! Some great ideas. I’ll give 'em a try.