-2

Need to validate values within a field against Value List, retaining the value if on list but substituting a specific Value if not?

michael.hor257k
  • 113,275
  • 6
  • 33
  • 51
  • Please don't change your question so radically after it has been answered. If you have clarifications, **add** them to the original question (which I have now restored). – michael.hor257k Jun 06 '16 at 05:34
  • P.S. I believe your problem would be much more suited for discussion in one of the forums dedicated to the FileMaker platform than here. – michael.hor257k Jun 06 '16 at 05:50

1 Answers1

1

I am afraid you are mixing two separate things:

Validation checks if some conditions have been satisfied; if not, it throws an error. It will not correct the entry.

If you want user entry to be corrected, you need to either:

  • define the field to auto-enter a calculated value; or
  • attach a script trigger to it, and have the script modify the value entered by the user.

In this case, you could auto-enter a calculated value (replacing existing value) =

If ( IsEmpty ( FilterValues ( Self ; ValueListItems ( Get (FileName) ; "YourValueList" ) ) ) ; "Specific Value" ; Self )

--- Added in response to your clarification ---

Technically, you could run a script to find the records you want to verify and do Replace Field Contents (using the same calculation) on that field. You could run the script after changing the value list, as part of the weekly routine.

However, there are two major problems with this approach:

  • some records could be locked by another user;
  • you have no history of what happened, and no way to go back in case of making a mistake.

I also don't think it's good practice to have users modify a value list routinely. If you need to have a weekly list of values, you should store them in records, not in a value list. That way at least the part of the value list would have a history.

Another option you may consider is using an unstored calculation field with a similar formula. This would change dynamically with the value list, and leave the original field unmodified. This would be a good arrangement if, for example, you need to export the corrected values every week.

michael.hor257k
  • 113,275
  • 6
  • 33
  • 51
  • Will try working with your suggestions. Sounds like it is workable. My only conern is that all the original field entries are already entered and that I wish to use a different Value list each week or so to validate with either keeping the Value (as is) or substituting another vale (eg invalid). Your understaing of this? – A Alexander Jun 05 '16 at 23:00
  • Are you saying you want to check all existing records every week and modify them if they don't fit that week's value list? While it *is* possible, I would suggest you rethink your entire strategy. – michael.hor257k Jun 05 '16 at 23:27