Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding Fields

Status
Not open for further replies.
May 31, 2000
34
US
I have a User Request database and I want to be able to let user insert comments into a field and then view those comments in another window. Because several users may enter comments. However I would like to have an action button to appear only when there have been comments entered.
 
if i understand correctly, comments are response documents to the main document and you want a button to show/hide depending on whether or not responses exist, right?<br><br>if so, then, simply create a view with a single column @text($ref) sorted. lets say this view is called (children), then your code will look like this:<br><br>@iserror(@dblookup( &quot;&quot;:&quot;&quot;; &quot;&quot;; &quot;(children)&quot;; @text(@documentuniqueid); 1 ))<br><br>this formula, anywhere on the form will evaluate to @true if there aren't any responses to the main document.<br><br>hope this helps,<br>rzen<br><br>
 
rzen- Help!

I just did a search for anything I could find in here relating to response docuemnts, and dblookups, and this is the only post I found.

I'm trying to do an @DBLookup, with reference to a specified key (doing nearly what you explained) and trying to populate a field with all the information I get back. This worked fine, UNTIL I started useing response documents. The keys are showing up great in the view when I look at it, but, when I do an @DBLookup on the exact keys, I ALWAYS get an error. The error always gives me &quot;Entry not found in index, or view's index not built&quot;.

I know I have those exact values in the first (key) column, and I even verified that I'm sorting on the first column. I was convinced that Notes just couldn't handle lookups on response documents, until I found this post!

Any idea what I'm doing wrong?
 
How about including your code and specific information on where you are using it? View selection? Field data? Server orlocally? Gamesman
jhughes@barbhosp.com
MT(ASCP), MCP, CIW, CNA
 
Well, here goes...
The truth is, I got a little more elaborate than response documents originally (since I've never used responses, because I could never seem to get them to work).

So, for that reason, I wrote some code to store the Parent document's Unique ID in the home-made response document, and in the view, I just showed that ID, and some other information that I was going to pull out (by @DBLookup) and stick into my field.

Here's the situation
It's a Reservations database I'm building. The main document is the &quot;Visit&quot; information, including all the info for our patrons, arrival date, departure date, etc.
The &quot;response&quot;s are each specific reservation they'll be requesting. I have a button on the main visit info document, that has an @DialogBox in it, and closing the dialog box, I create a new document, populate it with all the info from the dialog box, as well as a field called REF (No, not $REF) that has the current document's ID, then I save the new one, and delete all the fields that were created in the visit document from the DialogBox.

There's a field on my Visit document called dDining (computed for display, Dining reservation information) and a dEntertainment (computed for display, Entertainment reservations). They have @DBLookups to the view (called &quot;(ResSummary)&quot;) that has a computed field with summary info for displaying on the main Visit document. Their formulas are, respectively:
Code:
vTmp:=@DbLookup(&quot;&quot;:&quot;NoCache&quot;; @DbName; &quot;(ResSummary)&quot;; @Text(@DocumentUniqueID) + &quot;Dining&quot;; 4);
@If(@IsError(vTmp); &quot;&quot;; vTmp)
and
Code:
vTmp:=@DbLookup(&quot;&quot;:&quot;NoCache&quot;; @DbName; &quot;(ResSummary)&quot;; @Text(@DocumentUniqueID) + &quot;Event Center&quot;; 4);
@If(@IsError(vTmp); &quot;&quot;; vTmp)

The first column of the view &quot;(ResSummary)&quot;, is sorted, and it's formula is:
Code:
REF + @If(FORM=&quot;Reservation&quot;;RESTYPE;
FORM=&quot;TransportationForm&quot;; &quot;Transportation&quot;;&quot;UNKNOWN&quot;)
(The Transportation part is for a seperate document that I create for Airport limo service)
So, essentially, the view shows:
Code:
{ParentDocumentID}Dining             SummaryInfo
{ParentDocumentID}Entertainment      SummaryInfo
Putting the ResType in there was so that I the different reservation types seperately, and display them in seperate fields on the main visit form, but still be able to use the same Reservation Form for displaying each reservation alone.

This all worked great when I didn't use responses. I changed my &quot;Reservation&quot; form to a Response document, and modified the &quot;(ResSummary)&quot; view's selection formula to include @AllDescendants, and they all show up (when I look at it). I then changed my code in the Reservation creation, to include:
Code:
Call NewDoc.MakeResponse(CurDoc)
and tested it. Checked the properties of the new documents in (ResSummary) and can see a $REF field in it now, so I know that they are indeed children of the main visit doc.

But the dDining, and dEntertainment fields no longer see the information!

I originally did this all in a local database, but figured You've got a good point- maybe it's just a local thing- so I copied it to the server, and tried again. Still a no-go.

Changing the @DBLookup formulas to show @Text(vTmp) when it IS an error, resulted in display of
&quot;Entry not found in index, or view's index not built&quot;.

I've changed nothing else. I just can't understand why I can see the data fine in the view, but the lookups are broken. (now I know why I was so hesitant to use Response docs - heh).

BTW, I'm using Notes 4.6, if that makes any difference.

I think I've included everything, but if I left any other info out that might help you help me, let me know. 8O)

Thanks for any help you can give me!

-MoGryph
[8O)
 
Not sure that this is the problem but it instantly springs to mind so I'll mention before going through the code. Check you view columns in Design mode and make sure you are calling the correct column. Response and ResponsetoResponse documents get indented by a column spacer in a normal dialogue database. Gamesman
jhughes@barbhosp.com
MT(ASCP), MCP, CIW, CNA
 
Well- I found just found the problem. Obscurity sure does cause stress!

You know the Options tab, for the View Properties? You know that little option, that always defaults to True, and the option is....

&quot;Show response documents in a hierarchy&quot;.

I would never have even thought of changing that. I created a new DB, using the Discussion Datbase template, and was poking around - because I saw that it was working perfectly. Checked that options page, and low-and-behold. It didn't look right. Oh- that option's usually on! Ugh.

And all that typing and headache for a single checkbox. Picky picky picky. 8O)

Thanks for bearing with me though-

-MoGryph
[8O)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top