Jump to content
Sign in to follow this  
Mandu

Default value for value-list field

Recommended Posts

I have a text field called Customer_ID_String. It appears on a layout formatted as a drop-down value-list field, with Auto-complete.

There is another field, Customer_Number, defined to Auto-enter a calculation based on Customer_ID_String (via a simple relationship to the CUSTOMERS table)

Ordinarily it works fine when the user does the typing into Customer_ID_String. Then I tried to give a default value ("indiv") to Customer_ID_String, using auto-enter calculation. If the user chooses to accept the default value (tabbing to the next field without entering some other ID string), Customer_Number does not automatically recalculate itself! I've tried using auto-enter values that are unambiguous substrings ("indiv") as well as the complete ID string ("individual") with no luck.

So, in short, a manually-entered value will trigger an auto-enter calculation for a dependent field, but an automatically-entered value will not. (?)

Is there a way to trigger the dependent field (Customer_Number) to auto-enter when Customer_ID is auto-entered?

Thanks,

Chap

Share this post


Link to post
Share on other sites

I'm worried about what you're doing here, honestly. Are you having the user create IDs for your Customers? Please say "no."

Share this post


Link to post
Share on other sites

No, the user must choose from a predetermined list of strings. If you're wondering why I have both a Customer ID string and a Customer ID number (both of which are unique), it's because the number is the "true" identifier, while the string is simply a mnemonic identifier, for the user's benefit. If I find that I need to change the mnemonic to something more memorable, or that I need to add an alternate mnemonic (an alias or a nickname) for the same customer, I can do so without changing the "true" identifier, which is the Customer ID Number.

There's one "customer" in the DB named "Individual" whose ID string is "individual". If the customer is cash-only, he doesn't need to be in our DB and we identify him only as "Individual". Since this is the case more often than not, I want this as the default, with the following behavior: when the user tabs into the Customer ID String field, it is preloaded with "individual", which is totally highlighted. If User simply tabs to next field, "individual" is accepted and it triggers Customer ID Number to auto-enter the number associated with Individual. If the User instead begins typing, it should immediately replace "individual" and the drop-down list should shrink as usual.

Does that make sense? All of the above works fine, except that I can't manage to pre-load Customer ID String with the default value "individual" and have it appear highlighted or behave as if that's what the user typed in.

Share this post


Link to post
Share on other sites

OK, so you're on an invoice, and with a cash-only customer you want the customer "Individual" to be stored with that invoice.

Why not have the new invoice's _kF_CustomerID field default to the ID for the customer "Individual." Then the user can pick from either a popup of customers (value list from the customer's table (ID and String) or a popup window of customers to select a different customer. You could give the user a "New Customer" button that will popup a window that lets them add to the customer table and then puts that new customer id in the invoice.

The string is just another field in the customer table, and can be edited on the invoice layout.

Share this post


Link to post
Share on other sites

I thought it would be best to post a sample db to illustrate the problem, but in the process I created something that seems to do exactly what I wanted it to do!

I've attached the sample. The Invoice layout shows an "exploded" view of Customer_ID_String, Customer_ID_Number, and Customer_Name to illustrate how they are arranged along the Z-axis. When you tab into the Customer ID area, "individual" is pre-plugged and selected, allowing you to accept that as the default by simply tabbing out, or to enter a registered customer by simply starting to type a different mnemonic id.

This is exactly the behavior I wanted. I haven't located the problem in my actual project yet, but now I've shown myself it can be done! ;-)

DefaultVal.fp7.zip

Share this post


Link to post
Share on other sites

I have modified your sample. Basically, there are two goals:

1. Have a new invoice default to the customer, "individual."

2. Let the user easily select another customer.

You may wish to look at the version I've attached. It uses a popular technique, a popup list view for selection.

DefaultValv2.fp7.zip

Share this post


Link to post
Share on other sites

Thank you for your example.

I'm not sure that it is as easy to use as the scrollable pop-down list with auto-complete. On the other hand, it may be the easiest to understand for the complete novice; moreover, it provides a more thorough search function than does auto-complete.

Anyway, both techniques work. Is there a reason you would avoid the pop-down value list with auto-complete?

Share this post


Link to post
Share on other sites

Your method requires the user to create a unique string (very difficult in the long run, error-prone and really unnecessary). Also, the string may match incorrectly and bring in the incorrect CustomerID.

You were using a drop down list, not a pop-down value list (there is no such thing). I didn't change it to a popup menu, because when the value list exceeds 10 values, a popup is too cumbersome for easy data entry.

Share this post


Link to post
Share on other sites

Back to your very first question: on second thought, yes -- I AM requiring a user (specifically, the administrator) to come up with unique strings. However, the lowly staff members who actually use the app from day to day must choose from that list. They do not add customers or invent i.d. strings. The administrator's tool for adding customers can easily generate and validate a unique string. Most of the time it's simply the customer name, lower-cased, with non-alphanumerics removed.

The thing about auto-completion with a drop-down list is that, while initially it may be much too long, two or three keystrokes are enough to whittle that list down to a few entries -- often one. For that reason I've never agreed with the claim that it is cumbersome beyond 10 values.

Share this post


Link to post
Share on other sites

The thing about auto-completion with a drop-down list is that, while initially it may be much too long, two or three keystrokes are enough to whittle that list down to a few entries -- often one. For that reason I've never agreed with the claim that it is cumbersome beyond 10 values.

You are confusing drop down lists from popup menus. Obviously, it's your system to do what you please. I'm just showing you accepted best practices--and using user-created ids or strings to get ids is not a best practice.

Share this post


Link to post
Share on other sites

I don't know how pop-up menus got into the discussion, since I almost never use them - certainly not here. The example I posted above uses a drop-down list for Customer_ID_String. And it does behave in exactly the manner I wanted it to.

I would be interested in seeing a list of best practices, though. I wouldn't be surprised if what works best for me (the developer, the administrator, and the occasional end user) isn't necessarily best for John Q. EndUser.

Thanks for your input.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.