?
Solved

converting lookup code for use in framesets

Posted on 2003-03-18
14
Medium Priority
?
338 Views
Last Modified: 2013-12-18
I'm moving a registration database from pages to pages within frames.  I used to use this formula to evaluate whether the user had an existing registration.  If they did not, they got a blank form, otherwise they got their document in edit mode.

start================
user := @UserName;
test := @If(@IsError(  @DbLookup( "" : "NoCache" ; "" : "" ; "(SignupUserNames)" ; user ; 1 )); ""; @DbLookup( "" : "NoCache" ; "" : "" ; "(SignupUserNames)" ; user ; 1 ) );

@If( test = "";
  @Command([Compose];"foRegistration");
  @Command([OpenView] ; "(SignupUserNames)" ; user  ) & @Command( [OpenDocument] ; "0") )
end===================

I've been using @SetTargetFrame("frMain") with all of my [OpenPage] or [Compose] code, and it works great.  However, I don't know how to convert this code to show the users existing registration document in the "frMain" frame.  How should I being doing this?

0
Comment
Question by:SandraE
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
  • 3
  • +1
14 Comments
 
LVL 5

Expert Comment

by:AndrewJayPollack
ID: 8163190
Well, you could insert this little bit of html in your page (near the top is best):

[<base target="frMain">]

or, in the frameset properties, right click the frame that contains the link, and in that frame's properties, set the default target to "frMain".

Maybe I'm missing something though, what happens if you do this:

user := @UserName;
test := @If(@IsError(  @DbLookup( "" : "NoCache" ; "" : "" ; "(SignupUserNames)" ; user ; 1 )); ""; @DbLookup( "" : "NoCache" ; "" : "" ; "(SignupUserNames)" ; user ; 1 ) );

@SetTargetFrame("frMain");

@If( test = "";
 @Command([Compose];"foRegistration");
 @Command([OpenView] ; "(SignupUserNames)" ; user  ) & @Command( [OpenDocument] ; "0") )


0
 
LVL 7

Expert Comment

by:scottrma
ID: 8163307
Try this:

UNID := @DbLookup("":"NoCache"; "":""; "(SignupUserNames)"; @UserName; 1);
test := @If(@IsError(UNID); ""; UNID);

@If(test = "";
 @Command([Compose]; "foRegistration");
 @Do(@Command([OpenView]; "(SignupUserNames)"); @Command([OpenDocument]; "1"; UNID)))

I think the problem you're having may be related to the fact that you're trying to use @Command([OpenView]; ViewName; Key) to jump to Key and have that document selected, then use @Command([OpenDocument]) to open the selected document, but on the Web there is no concept of selected document (only the Notes client allows you to "select" a document in this sense).

In the example above, make the first sorted column in your (SignupUserNames) view have a formula of @Text(@DocumentUniqueId). Then, your @DbLookup will retrieve this value (the Notes UNID of the document, if the document exists). It then passes it to @Command([OpenDocument]) and you can then open the document in this way.

Also, just for optimization purposes, in the example above, I have removed one of your @DbLookup's, and assigned it to a temporary variable. It's best not to do the same @DbLookup function over and over again, as Notes will need to execute the lookup again and again (performance will suffer). By instead assigning it to a temporary variable and simply referencing that variable from that point on, you get much better performance.

Regards,

Scott
0
 
LVL 1

Author Comment

by:SandraE
ID: 8164617
This is my code right now, and it works ... almost.  (all of this is for the Notes client, V5)  I have my actions in a page in frame "frLeft" and all my pages, forms and documents should open in frame "frMain".

When I open the database, the code works perfectly.  If, however, I open another page, and then click this action, then I get the view and an error message "Cannot execute the specified command" and I'm left with the view in the frame instead of my opened document.

=====================
UNID := @DbLookup("":"NoCache"; "":""; "(SignupUserNames)"; @UserName; 2 );
test := @If(@IsError(UNID); "1"; "" );

@SetTargetFrame("frMain") ;

@If( test != null;
@Command([Compose]; "Registration");
@Command([OpenView] ; "(ByUNID)" ; UNID ) & @Command([OpenDocument]; "1"; UNID) )
======================

what's wrong?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:SandraE
ID: 8164626
p.s.  I did try both code suggestions, and neither worked like I need in this situation.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8165318
Dear Sandra,

below the Action name in Action property dialog is an attribute labelled: TargetFrame
Put into this field your frMain

And change your Action formula to this:
UNID := @DbLookup("":"NoCache"; "":""; "(SignupUserNames)"; @UserName; 2 );
@If(@IsError(UNID);
@Command([Compose]; "Registration");
@Command([OpenView] ; "(ByUNID)" ; UNID ) & @Command([OpenDocument]; "1"; UNID) )


Good luck,
Zvonko
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8165404
Sorry, it seams Target Frame works only for web.

But this works for me:

UNID := @DbLookup("":"NoCache"; "":""; "(SignupUserNames)"; @UserName; 2 );
@SetTargetFrame("frMain") ;
@If(@IsError(UNID);
@Command([Compose]; "Registration");
@Command([OpenView] ; "(ByUNID)" ; UNID ) & @Command([OpenDocument]; "1"; UNID) )


So when do you mean "opening another page"?

I did also set both, the Frame name and the option DefaultTargetForLinksInFrame
I don’t know whether it really does help.

0
 
LVL 1

Author Comment

by:SandraE
ID: 8168886
I still have the same trouble.  I set the Frame name and the option DefaultTargetForLinksInFrame in the frameset.  

I tried setting the form options to only open in this frameset and in the "frMain", but that didn't work either.

What I want is to open a doc in a frame.  Am I going about it in a completely wrong way?
0
 
LVL 1

Author Comment

by:SandraE
ID: 8168905
... I set more points, this is a tough question ... much thanks to all for all of this help
0
 
LVL 1

Author Comment

by:SandraE
ID: 8170398
I'm still working on this.  I put my code into an agent, and run the agent from the Outline entry.  That gets me past the error message.  But not to an open document.  Now I just open to the view, but the document is not opened.

Should I be using a lotus script agent?  Would a FT search for the doc's UniqueID get us away from this OpenView nonsense?

By the way, this LS agent is over my head, so I'm bumping the points again in case someone wants to take a run at it.

Thanks to all.
0
 
LVL 7

Accepted Solution

by:
scottrma earned 2000 total points
ID: 8170712
Dim s As New NotesSession
Dim ws As NewNotesUIWorkspace
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument

Set db = s.CurrentDatabase
Set view = db.GetView("(SignupUserNames)")
Set doc = view.GetDocumentByKey(s.UserName,True)

Call ws.SetTargetFrame("frMain")

If doc Is Nothing Then
     Set uidoc = ws.ComposeDocument("","","Registration")
Else
     Set uidoc = ws.EditDocument(True,doc)
End If
0
 
LVL 1

Author Comment

by:SandraE
ID: 8170743
it doesn't like this line:

   Set uidoc = ws.EditDocument(True,doc)
0
 
LVL 1

Author Comment

by:SandraE
ID: 8171573
Guess what .. it's working.  You know what it wanted?  A space in "dim ws as New NotesUIWorkspace".   Thanks a million.  I have the code in an agent that runs from the outline entry formula.  Zvonko, you too were so helpful.  I'm learning lots from you.  Thanks for all your time and effort.  And Scott, I can go home now.  Thanks so much!
0
 
LVL 7

Expert Comment

by:scottrma
ID: 8172007
Hi Sandra,

Glad to hear you got it working. Yes, the missing space was a typo on my part - glad you caught it.

You may want to award points to whoever's comment you feel helped you the most.

Regards,

Scott
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8172173
Hello Sandra,

your feedback is the best wage we can hope here as experts :-)

And please do not award points to me.

Perhaps next time :-)

So long,
Zvonko

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question