?
Solved

Computed Field

Posted on 2003-03-28
19
Medium Priority
?
256 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
[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
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
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