?
Solved

Computed Field

Posted on 2003-03-28
19
Medium Priority
?
257 Views
Last Modified: 2013-12-18
I have a branch view w/ 2 columns, brcode and brname. In my form, i have a field named bcode and bname, bcode is a dialog list type field, and i used the first column of branch view for the list of choices, my question is, how will i automatically assign the corresponding brname of the one i entered in the brcode field. ex. bcode = 1 bname = one, if i type 1 in the bcode field, the bname should be "one"?.
0
Comment
Question by:makuletski
  • 10
  • 9
19 Comments
 
LVL 7

Expert Comment

by:scottrma
ID: 8229758
The bname field should be Computed and should have a formula like:

@DbLookup("":"NoCache"; ""; "MyBranchView"; bcode; 2)

Regards,

Scott
0
 
LVL 7

Expert Comment

by:scottrma
ID: 8229763
You can also set the properties on the bcode field to refresh fields on keyword change.

Regards,

Scott
0
 
LVL 7

Expert Comment

by:scottrma
ID: 8231277
An improvement on the field formula above would be this:

temp := @DbLookup("":"NoCache"; ""; "MyBranchView"; bcode; 2);
@If(@IsError(temp); ""; temp)

where "MyBranchView" is the name of your branch view where you are doing the lookup. This will simply return an empty string if there is a problem or error in the lookup, otherwise, it will return the value in the 2nd column of the lookup view, using the value in the bcode field as the lookup key.

Regards,

Scott
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:makuletski
ID: 8250908
error message "enty not found in index or view's index not built" appeared
0
 
LVL 7

Expert Comment

by:scottrma
ID: 8251056
That's exactly the reason why you should use the 2nd formula I gave you instead:

temp := @DbLookup("":"NoCache"; ""; "MyBranchView"; bcode; 2);
@If(@IsError(temp); ""; temp)

Remember, I don't know what your actual view name is, I just used "MyBranchView", you must substitute your actual view name there in the formula.

Regards,

Scott
0
 

Author Comment

by:makuletski
ID: 8251061
error message "enty not found in index or view's index not built" appeared
0
 

Author Comment

by:makuletski
ID: 8251358
i did substitute the actual view name (w/c is "branches"). here's what i did, i used the formula @Text(@DbColumn("";"";"branches";1)) (coz, if not, the dialog list box would contain "keywords must be text" error message) then in the computer field bname, i place the 1st formula u gave. i used the 1st formula bec. i need the branches to appear in the field and it shldnt be an empty string. any suggestion?......tnx =)
0
 
LVL 7

Expert Comment

by:scottrma
ID: 8251382
Your "branches" view must be sorted. Otherwise you will get "Entry not found or view index not built" error.

Regards,

Scott
0
 

Author Comment

by:makuletski
ID: 8251582
1st column of the branches view is sorted (ascending)
0
 

Author Comment

by:makuletski
ID: 8251605
1st column of the branches view is sorted (ascending)
0
 

Author Comment

by:makuletski
ID: 8251669
1st column of the branches view is sorted (ascending)
0
 

Author Comment

by:makuletski
ID: 8251675
sorry, every time i click the refresh button, the same comment appears
0
 
LVL 7

Expert Comment

by:scottrma
ID: 8255316
In that case, then the bcode field in the form is not providing a valid key to your branches view. If the bcode field is null (which is probably the case when you first compose the document unless the bcode field has a Default Value), then you don't have a valid key to do the lookup. So, make your formula for the bname field something like this:

@If(bcode = ""; "No branch code specified yet"; @DbLookup("":"NoCache"; ""; "branches"; bcode; 2))

Let me know how this goes. Thanks.

Regards,

Scott
0
 
LVL 7

Expert Comment

by:scottrma
ID: 8255334
Also, there is a link in the top left hand corner of the page that says "Reload this Question". Use this link instead of the browser's Refresh button, as that would cause your comment to get posted again and again.

Regards,

Scott
0
 

Author Comment

by:makuletski
ID: 8258434
initially, the bname's value was "No branch code specified yet", but when i entered a value on the bcode's field, it changed to the previous error "View's index not built..."

0
 
LVL 7

Expert Comment

by:scottrma
ID: 8259566
Try this one:

@If(bcode = ""; "No branch code specified yet"; @DbLookup("":"NoCache"; ""; "branches"; @Text(bcode); 2))

The lookup key must be text, so use @Text to convert it to text before doing the lookup.

Regards,

Scott
0
 

Author Comment

by:makuletski
ID: 8289211
"the data type of two matching results are incompatible" was the content of my bcode dialog list when i tried the code...(i did place the code in the bname computed field though)
0
 
LVL 7

Accepted Solution

by:
scottrma earned 400 total points
ID: 8289273
Could you please paste here the formula that you are currently using in both the bcode and the bname fields so that we can check for any problems? Thanks.

Regards,

Scott
0
 

Author Comment

by:makuletski
ID: 8312584
sorry, i already deleted the code i used, i used instead the option "use address book dialog for choice" so all the branches in the address book will appear..it worked out ok now...ill still award u the points though....thank you very much for all your comments
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

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…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
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…
Suggested Courses

578 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