@dblookup issue

Hi there,

I have 2 forms, A and B. Form A pulls up some info from Form B using @dblookup fields. Problem is when there is a change made on Form B, it does not update Form A at the same time. Is there a way to keep the info on both form in sync? I’ve tried nocache, recache, cache … nothing works, the only time I would see the change is if I exit out of lotus notes and log back in. Also, I have all automatically refresh Checked in both fields and both forms.

Thanks!

Subject: RE: @dblookup issue

You don’t actually have to exit Notes – you just have to exit the application. But you have to close all the windows on that application, including in Designer.

Someone’s going to tell you to use NoCache option on the lookup. That might be necessary, but it’s to be avoided if possible.

The best approach depends on the frequency with which the data in form B is updated. If form B is a configuration document of some sort that’s going to change once in a blue moon once the application is in use, I’d suggest you just put up with it during development.

If the data changes too frequently for that to be practical, you might use the ReCache option of @DbLookup to update the cache when the looked-up data changes. So for instance, if form A uses the lookup:

@DbLookup(“”; “”; “viewX”; companyID; 2)

then in the Postsave event of form B, you might do something like this:

REM “Update lookup for companyName field in FormA”;

@DbLookup(“”:“ReCache”; “”; “viewX”; companyID; 2);

“”

(I’m assuming here that the fieldname for the key field is the same in both forms, companyID). This will refresh your cache; other users will still see the old value until they exit and reopen the application, if they have done that exact same lookup during that session.

NoCache option would make sure the lookup is always up to date, but at some cost in performance. Bear in mind that performance depends largely on the number of documents in the application and the number of users, so something that’s just a little slow now might be a lot slow later on. Exercise judgment.

Subject: RE: @dblookup issue

Thanks for the responses Stephen and Andre. Question: Is there a way to get the dblookup populated without closing your application?

Thanks again.

Subject: RE: @dblookup issue

You do NOT have to close the application. You do have to save document(s) created by Form B, before you can see them in form A.

What I’m not sure is how you want see the values in Form A.

(1) You want it anytime someone opens (for reading), or creating a new, or editing an exist a document using Form A, the field doing the dblookup will show the data from documents using Form B. So if documents already exist and have been saved using Form A, they will automatically update.

Is this what you want?

(2) You want it anytime someone is creating new or editing existing documents using Form A, the list of choices for a field using the dblookup will have all the values form documents created using Form B.

If it’s the second In the second case and you’re running into a problem something like this:

Form A ask the user to fill in information about themselves. One of the question is their favourite colour.

The list of favourite colours comes from Form B (a keyword document).

While filling in the form, I go to pick my favourite colour and don’t see purple.

I phone of the manager of this application and request that they add purple to the list.

They said they will do it in a minute and in the meantime, I fill in the result of the form (I don’t exit the document).

The manager of the database calls back saying purple has been added.

Now when I click on my favourite colour picklist you want to see: green, red, blue and purple.

This can be done.

The trick is where the @DbLookup is located. If you’ve got it in the choices field for a radio button, checkbox or keyword list it won’t change because this value is set when the document loads.

If however, you create a hidden tmpfield or use a hotspot you can configure it to “relaod” the latest data.

Is this what you want?

Subject: RE: @dblookup issue

Hi Stephen,

Thanks for your response. I am trying to do #1 option.

(1) You want it anytime someone opens (for reading), or creating a new, or editing an exist a document using Form A, the field doing the dblookup will show the data from documents using Form B. So if documents already exist and have been saved using Form A, they will automatically update.

Thanks!

Claire

Subject: RE: @dblookup issue

Please, please, please, take a class, or get yourself a copy of Rocky’s book and read it. Don’t come in here and ask a long series of very basic questions that every other new developer has also asked. It’s inconsiderate of those people who come here with hard problems. Many of us are tired of answering the same questions over and over.

Subject: RE: @dblookup issue

f.y.i - I’ve taken courses and I’ve also have a copy of Rocky’s book. I’ve also been using @dblookup for years, but when there are times when you tried everything (including Nocache, Recache, Cache) and its still not working … you would think you could come to this forum for a second opinion without having impertinent responses.

This is a lotus notes forum (which you should probably get a copy of the Oxford Dictionary or better yet, look up the meaning of forum online), if you think that Im asking the same questions over and over again, then you should not concern yourself in responding. I believe my last response was actually to Stephen.

Subject: RE: @dblookup issue

I’m not attempting “impertinence” here – I’m trying to get you to the shortest way to fix your problem. If you really knew practically nothing about Notes development, getting training saves so much time on everything that it’s the shortest way.

What made me think you were a novice, is that you ask vague theoretical questions like “Is there a way to keep the info on both forms in sync?” and “Is there a way to get the dblookup populated without closing your application?” (the latter, by the way, I had already answered in that same thread – it doesn’t appear that you read my answer). This is the sort of question beginners often ask, not realizing that the details of the situation are critically important. Your failure to provide any details to make it possible to answer your question at less than book-chapter length – and your apparent failure to understand my first answer – was what made it seem to me that you were a novice.

I suggest you describe your problem in exact and specific detail, and show what you’ve tried, with details of your design and source code, and giving the series of steps you do in the client, your expected and actual results. That’ll let us see just what the problem is. As it is, though you’ve posted several messages about the problem, we still don’t know, for instance, whether you’re trying to update data stored in a document (for instance, by a computed field) or trying to get data to update when you do a live lookup on opening the document (because the field is computed for display). As an experienced developer, of course you would not expect a computed field’s value to update automatically without your editing and resaving the document. And of course, you will have used the document properties dialog from a view to verify whether the field in question might be stored in the document from before, preventing recalculation when opened for reading.

Subject: @dblookup issue

Depends where the @DBLookup is done. If the DBLookup is inside the choices of a field, it’s set when the document is opened / loaded.

If you put it in a hotspot it should work like you want, assuming documents created using FormB have been saved.