I see two ways to do that:
1. Use and auto enter value (or calc) defined for that field (In the field definitions)
2. Use a script (trigger) to auto populate.
In either case you can simply hardcode the value, i. e. enter "Fluid Level - Producing"
or be more flexible, in case you edit the valuelist, and use functions:
listNumber = 1; //change to the list you need
valueNumber = 2; // change to the position of the value you need
vlist = getvalue (valuelistNames (get (filename));listNumber);
value = getvalue (ValueListItems (get(Filename) ;vlist);valueNumber)
Hope this helps,
I might rather recommend that you use an auto-entry calculation option on the field, with "do not replace" and "do not evaluate if" both unchecked.
not IsEmpty ( self )
; "the most likely value"
As Chris suggested, the best way is to use an auto enter calc. So it does not need to go in your script, but rather in the field definition (manage database, double click your field). Check the "auto enter calculation" option and enter your preferred value or formula there. Now every time a record gets created that value will be put in your field.
I appreciate the input. I am pretty week on my formula writing. Could you please explain the formula is a little more detail.
In Manage Database, find the field and click on options. On the Auto-Entry tab, click "by calculation". Enter the formula I gave you, and uncheck the "do not evaluate..." option at the bottom of the window. Click OK. Uncheck the box that says "do not replace..."
The function uses "case", "isempty" and "self". "Case" can be thought of as "in the case that..." and takes parameters for condition (something that's either true or false), result (what to return if the condition is true) and default (what to return if the condition is false). There are other options, but you can search help for them.
Self, when used in a field definition, refers to the field you're defining.
Isempty is either true or false, depending on whether the thing you're checking contains anything.
So, the function says, essentially, "In the case that this here field is not empty, return whatever is in the field. Otherwise, return 'the most likely value'".
Since we're allowing the calculation to enter a value even if the field is empty, or even if it has a value, then the field will always have something in it. When you first create the record, you'll get "most likely value". If you enter something, that'll be the "self" and it'll enter itself (basically, it'll keep whatever you put in). If you try to clear the field, it'll change to "most likely value".
Does this help? I'm not sure which part's giving you trouble, so I probably explained stuff you already knew.
That is perfect feedback. How would I set it up to select a specific value from a value list that automatically fill in that field?