wvdb Posted December 15, 2008 Posted December 15, 2008 I need to auto check a 2008 Holiday Card check box based on a found set. I also don't want to update any in the found set which may already have this box checked. I've tried to use a loop with set field where the calculated value equals the current field & "2008 Holiday Cards" however this isn't working and I'm worried it may add the value to records that are already checked. Any ideas? Thanks
bcooney Posted December 16, 2008 Posted December 16, 2008 I don't understand why you can't recheck a checkbox? Who'll know? How is it bad?
wvdb Posted December 16, 2008 Author Posted December 16, 2008 I think I should be able to avoid updateding records that have already been checked by adding a 2nd request to omit these during the find, but I'm still stuck on checking the box by script.
wvdb Posted December 16, 2008 Author Posted December 16, 2008 I didn't want to add a duplicate string of text in the list for 1000s of records. I wasn't sure how FM would handle having multiples like that.
wvdb Posted December 16, 2008 Author Posted December 16, 2008 I got it to work. It needed a CR added in front of the "2008 Holiday Cards" string. I would still like to know what happens if I add a value multiple times using set field. Is it safe to do this?
comment Posted December 16, 2008 Posted December 16, 2008 Well, you will have to uncheck the box twice, if you want to remove the double value. I don't know what else you intend to do with this field, so I cannot tell what other repercussions it might have. Why don't you constrain the found set before adding the value, or use a calculated result, e.g. Checkbox & Case ( IsEmpty ( FilterValues ( "NewValue" ; Checkbox ) ) ; "¶NewValue" )
Fenton Posted December 16, 2008 Posted December 16, 2008 (edited) A field formatted as a checkbox contains a return-separated value for each value checked, ie., multi-line. There are various ways to handle the result. One is to use a global field, put a value in it, then use a self-relationship to the checkbox field to test for a match. This automatically only matches entire lines, so will not have false positives. Alternatively you can use the PatternCount() function to test, in a Loop. But that will match the pattern anywhere in a line. So it depends what the value is whether that is going to be safe enough or not. The safest way to match is to add returns to both the field, and the value. Then it will only match entire lines, and it will not matter if it is the first or last line. PatternCount ( ¶ & checkbox & ¶; ¶ & value & ¶ ) Or, as you say, omit them first. Though this would also depend on whether the Find result could have false positives. In your case, I doubt it ("2008 Holiday Cards"). But if you just set the field to itself & ¶ & value, then you could end up with the value in there twice, as 2 separate lines. It would only show in the checkboxes once. But it is kind of weird. (As comment said, especially when clearing the value.) Edited December 16, 2008 by Guest
wvdb Posted December 16, 2008 Author Posted December 16, 2008 Thanks for the help. I did the omit first and it worked with no duplicate values that I could see in an export of the field.
Recommended Posts
This topic is 5822 days old. Please don't post here. Open a new topic instead.
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 accountSign in
Already have an account? Sign in here.
Sign In Now