Page 1 of 1

Select Field entries and field data display

Posted: Fri Sep 10, 2021 3:47 pm
by icoso
I have a Selection Field (1st Year) that the user must select for new records. So on a new record this 1st year would be most likely the current year (2021). My current list of selections go from 2010 through 2025.
However this is a database in which I converted from a prior 3rd party database system has over 10,000's of records. Many of these records have a 1st year date PRIOR to 2010.

When I view a record in the Form for a record in which the 1st Year field has a year prior to 2010 it does not display. If I then duplicate this record, the 1st Year field does not duplicate over to the new record, so I end up with a record with a 1st Year field of 0.

Is there ANY WAY (without a lot of programming) to allow this field to display and copy the values prior to the 2010 that is in the selection list, WITHOUT adding in years to my selection list all the way back to the 1980's?

If not, what would you recommend as a way to "fix" this issue?

Re: Select Field entries and field data display

Posted: Fri Sep 10, 2021 5:08 pm
by kev1n
icoso wrote:and copy the values prior to the 2010 that is in the selection list
What do you mean by that?
How about displaying those years in a separate object?

Re: Select Field entries and field data display

Posted: Fri Sep 10, 2021 7:44 pm
by icoso
When I am looking at a record in a form view. I don't want to display a field in another field object. Doing so makes no sense at all. I have a single form that has a record displayed on it, name, address, city, etc... Current year, 1st year, etc... They are just regular fields on a form. If I click my duplicate function, I have it duplicate all fields except a few, (those don't matter). The 1st year field and current year fields are "selectable" fields. The Selection option list for both those fields shows 2010|2010|2011|2011....2025|2025.

When I converted all this original data, MANY of the records had a 1st year value prior to 2010, ie 1999. Therefore, it seems as if the NUB form will NOT display those field values in the 1st year field on the form since the value (1999) is not in the defined selection list. Because the value is not displayed, when I click my duplicate button to duplicate the record, that value(1999) that is actually in the record Im looking at but not displaying on the form, does not get duplicated to my new record.

1. Is there any way around this limitation of the form NOT displaying field values that are not in the selection list, even though the value of 1999 is in the database record?
2. (this question doesn't apply if the answer to 1 is no). Is there any way to copy/duplicate that field value even though the form is not displaying it because of the issue described above.

Re: Select Field entries and field data display

Posted: Sat Sep 11, 2021 7:31 am
by kev1n
Using an additional object (e.g. year2_id) allows you to transfer its value to the year select like:

Code: Select all


var y = $("#year_id"); // visible select object, containing the year >= 20210
var y2 = $("#year2_id"); // hidden text object, containing the year, also prior to 2010

if (y.val() == '' && y2 != '') { // if the year is not displayed in the select but in the text object, add the year of the text object to select 2
  y.append($('<option>', { value: 1, text: $("#year2_id").val(), disabled : true, selected: true, hidden: true }))
}

When cloning the record, you might have to transfer the value again.