Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

converting lookup code for use in framesets

Posted on 2003-03-18
14
Medium Priority
?
340 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
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

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.

Question has a verified solution.

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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses
Course of the Month10 days, 2 hours left to enroll

571 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