If someone checks m multiple things, then you will have a ¶ in your field. So check to see if you have that and that will give you a chance to act
So are you saying that if say I 'check' 3 items, even though they are a., b., c., that I could end up with:
This hasn't happened with a checkbox field under similar circumstances.
Three check things from a Value List would be
If you have checked a, b and c in that field
I should have said, the value list is based on B::Region, ie. a field, not a Custom VL. So I assume multiple values should not come from a field VL?
I suggest posting a screen shot of your script.
I'm experimenting with a different structure, but the script below still causes the same duplication in the 'Region list' (Global is listed many times, then once each for any other items checked in the checkbox field). Conversely, the 'Company list' shows correctly, ie. each item checked is shown just once:
Set Field [ Control::L Region list; Control::L Region ]
Set Field [ Control::L Company list; Control::L Company ]
PS. I once saw a script (and cannot now find it) where Philmodjunk showed how if a tier 1 list were unchecked, not only did the tier 2 list shrink, but those items there were checked but no longer shown (and I think only those items) were unchecked, so as to not be 'secretly' influencing functionality. If anyone can remember where this was shown, I'd v. much appreciate seeing it.
I don't recall exactly what you describe. Not sure what you mean by "tier 1 list".
but I do suggest that you put copies of your check box fields next to the current copies and change the copy's format to that of edit box so that you can inspect the actual data in the field.
Nothing that you've shown thus far shows any reason for getting duplicates.
If this step:
Set Field [control::L Region List: Control::L Region ]
produces duplicate values in the L Region List field, then those duplicates would have to exist in L Region.
In addition, I can't get what is your purpose to set the list.
If you check value "A" on A::region and the result is "B¶A" (B was already checked), only a record in B::region having value "A" (or first related record with sorted in correctly saying) is set to the list.
Phil, yes, they did show in an edit field. This field had previously been trialled with an auto-enter a. Date > "Global" then b. Calculation > list("Global"; self) in order to ensure "Global" was always on the list. However, both had been deactivated. Still, I deleted and re-made the L Control field and the duplicates no longer appear. I'm still unsure why they ever did once I'd deactivated these settings.
User19752: The purpose. I've got 3 hierarchical, conditional checklists: Region, Company, Feed. As such they work fine. However, as Phil pointed out in a script I can no longer find, if I uncheck a Region, I want all the checked Company records that no longer appear in the Company value list to be unchecked. Again, I can do this BUT I've not found a way to keep checked those Companies that were checked and STILL appear in the Company value list.
Hence I'd thought to record in a list, those Companies that were checked to re-check them after they all get blanked by a change in the Regions. I'm a bit lost in my trials of this.
To give the proper relationship names to my Control and Feed tables:
Control:: L Route < Feed_Region::Route
Control:: L Route < Feed_Region::Route and
Control:: L Region < Feed_Company::Region
Control:: L Route < Feed_Feeds::Route and
Control:: L Company < Feed_Feeds::Company
I'm still unsure why they ever did once I'd deactivated these settings.
Changing what values appear in a value list has no effect on what data is stored in a field formatted with that value list. One of the "gotchas" to look out for is that the values listed for a radio button or check box format can hide the existance of other data in the field that does not currently match to any of the value list values. If you are going to change the values in a value list and also need to remove the data entered by selecting values no longer in the list, you have to use a script or replace field contents to remove that data from the field. Changing the value list definition won't do it.
Exactly, it's the script I'm struggling with. In general terms, how do you 'grab' the checked Companies that are still related to Control when a Region is unchecked and therefore reduces the number of Companies now related to Control?
I'm not sure that I understand you.
Simply clearing a checkbox by clicking it removes the value from the field. Editing the value list definition to remove a value from the list, on the other hand, does not alter the data in the field.
But what I meant was if I had say Regions A, B, C, each with 2 companies A.1, A.2 etc. if I'd got Regions A and B checked, Companies A.1&2 and B.1&2 would show in the Companies value list. If all the latter were checked, but then I unchecked Region B, I'd want Companies B.1&2 to become unchecked but A.1&2 to stay checked.