Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

In Filemaker 10 - how to remove or uncheck one item from list

Posted on 2011-05-09
6
Medium Priority
?
484 Views
Last Modified: 2012-05-11
I have a field that has several items in it based on a value list.  I have used checkboxes to check values.  Now I have one value that I want to remove from the list.  First unchecking it from those records that have it, then removing it from the value list - without affecting the rest of the list.  I realize these are part of a list, so it will be just getting that one word out of the list somehow.

I also want to do this the other way, going through and adding one item to the list for particular records.

I would like to do this all with a script.
0
Comment
Question by:ServalStudios
  • 3
  • 3
6 Comments
 
LVL 4

Expert Comment

by:challengeday
ID: 35722422
Hi ServalStudios,

Adding and removing items to a list can be a little tricky. The best way I've found to work with lists is to go to the layout where the checkboxes are, make a copy of the field and then double click on it. Where it says "Display as" set it to Edit Box.

Open up the field and look at it in browse mode. You'll notice that you can see the selected values as a list with returns after each item. This is how FileMaker sees the values and this is how you need to work with them (if you want to do all of this with a script).

In other words, you have to take into account the return character after each item.

Since you'll have two fields showing the same thing, you can check and uncheck items on the one field and see how FileMaker handles the list by looking at the second "Edit Box" field.
0
 
LVL 1

Author Comment

by:ServalStudios
ID: 35722692
Great, so how do I go through and pull out just the one value?
0
 
LVL 4

Accepted Solution

by:
challengeday earned 2000 total points
ID: 35722822
Let's say you have a checklist with 4 possible values:
A
B
C
D

And on this particular record, someone has selected A,B,D, so the list in the edit box field looks like this:
A
B
D

Now lets say you want to remove B, using a script. You would use the "Set Field" script step. Under Calculated result you could use the "Substitute" calculation, including the paragraph mark, like this:

Substitute ( fieldX ; "B^P" ; "" )

Note, I'm using ^P for the paragraph mark. However, that's because Experts Exchange doesn't handle the paragraph mark correctly and it will just show an upside down question mark. Anyway, you'll find a handy paragraph mark button under the & and the "" under Operators, to the left of View functions. I'm uploading a picture so you can see what the calculation actually looks like.

 substitute.jpg
The above calculation will give you a result of
A
D
which is what you want.



0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:ServalStudios
ID: 35723779
Great.. I set up a database with a field with six colors.  I tried it with the paragraph mark and it only worked on a few. So I eliminated the paragraph mark and it worked on all.

Any idea how I would add something to a set of records?
Thanks!
0
 
LVL 4

Assisted Solution

by:challengeday
challengeday earned 2000 total points
ID: 35724030
My guess is  that it didn't work if the item was the only one checked, or the last one in the list, so you could do this to cover those cases:
Case (
    PatternCount ( fieldX, "B^P" ) > 0 ; Substitute ( fieldX ; "B^P" ; "" ) ;
    PatternCount (fieldX, "B" ) > 0 ;  Substitute ( fieldX ; "B" ; "" ) ;
)

You can do it without the paragraph mark and then you might end up with some extra paragraph marks. Those are ignored for the most part and you'll be fine unless you need to do some further manipulation down the road. You can then clean them out by doing Substitute ( ^p^p; ^p ).

To add an item what you want to do is use Set Field again and this time keep the contents of your field while you add a new item to it. Let's say you want to add a checked option E to the list in fieldX, then you would do Set Field and in  the calculation do:

fieldX & "^PE"

That carries over your contents and then adds a paragraph mark and the new item, so your result will  be:
A
D
E

In order to do this for a set of records in a script you can do them all in one fell swoop using the "Replace Field Contents[]" script step.

You can also do it one at a time in a loop using Go to Record like this:
Go to Record/Request/Page [ First ]
Loop
  Set Field [ <your calculation here>]
  Go to Record/Request/Page [ Next ; Exit after last ]
End Loop

You want to make sure you have :"Exit after last" checked or you'll get into a never ending loop and those are no fun!



0
 
LVL 1

Author Closing Comment

by:ServalStudios
ID: 35739235
Thank you so much for the help! This works great
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
Having just upgraded from Filemaker 11 to Filemaker 12 over the weekend, we thought we would add some tips for others making the same move.  In general, our installation went without incident. Please note that this is not a replacement for Chapter 5…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question