1 2 3 4 Previous Next 51 Replies Latest reply on Dec 22, 2011 8:28 AM by mgores

    copy data from text field to checkbox

    DavidCKantor

      Title

      copy data from text field to checkbox

      Post

      I have records with an entry in a text field and I would like to transfer that data to a checkbox within the same record:

      EXAMPLE:

      I have 200 records with a field called <mailing>. Of those 200 records, 100 have a entry in that <mailing> field. All records also have a filed called <correspondence> which contains a list of checkboxes, one of which is "2010 mailing".

      I would like to make it so that all records which contain ANY TEXT in the field <mailing> will have the "2010 mailing" checkbox checked. I intend to then delet the <mailing> filed and use only the checkboxes for keeping track of this info.

      any suggestions would be greatly appreciated.

      thanks

        • 1. Re: copy data from text field to checkbox
          raybaudi

          You could try this calculation:

          Case(
          not IsEmpty ( mailing ) ; "2010 mailing"

          • 2. Re: copy data from text field to checkbox
            philmodjunk

            Make a back up copy of your database.

            Enter find mode

            Put an * in the mailing field and perform the find

            You now have a found set of just those records with some kind of data in the mailing field.

            Click the check box field, clicking the same check box twice so that you do not change the selections. (This puts the focus on the checkbox field).

            Select Replace Field Contents  from the Records menu and click the calculation option.

            Enter this calculation:

            If ( IsEmpty ( FilterValues ( valueListItems ( get ( FileName ) ; "YourcheckboxValueListNameInQuotesGoesHere" ) ; "2010 mailing" ) ) ;
                 List ( YourTable::YourcheckBoxField ; "2010 mailing" ) ; YourTable::YourcheckBoxField )

            and perform the replace. (This can't be undone, so if you get unexpected results, replace your file with the back up copy you made at the start of this process and try again.)

            Note, we could just use List ( YourTable::YourcheckBoxField ; "2010 mailing" ) to add the selection, but if the check box is already selected, this would add the value a second time to the field. This really wouldn't cause a problem in most cases--the checkbox group would still correctly display the proper selected checkboxes--but I prefer not to include redundant data hidden inside a checkbox group formatted field.

            • 3. Re: copy data from text field to checkbox
              DavidCKantor

              PhilModJunk:

               

              I get an error "sepcified field cannot be found" with the following code:

               

              If ( IsEmpty ( FilterValues ( valueListItems ( get ( FileName ) ; "DiscussionPapersEmail" ) ; "sort tag 4" ) ) ;
                   List ( Contact Management::DiscussionPapersEmail ; "sort tag 4" ) ; Contact Management::DiscussionPapersEmail )

               

              my checkbox is "DiscussionPapersEmail" and the field I want to grab data from is "sort tag 4" and the table is "Contact Management"

              can you see my error?

               

              thanks

               

              • 4. Re: copy data from text field to checkbox
                philmodjunk

                What part of the expression is highlighted?

                When you open Manage | Value lists, what do you see as the name of the value list used with your check box group.

                While it's not the cause of your error. "Sort tag 4" is not what you should have in quotes here. You should have the value from your value lists that you want to have selected when you click that item in the check box group. Sort Tag 4 would not be referenced anywhere in this expression.

                 

                • 5. Re: copy data from text field to checkbox
                  DavidCKantor

                  sorry

                  DiscussionPapersEmail  - which is the checkbox, is highlighted

                  values are from "Mailing History"

                  In your example what is the entry:

                  "2010 mailing"

                  should this be the field I'm drawing data from?

                  thanks

                  • 6. Re: copy data from text field to checkbox
                    philmodjunk

                    DiscussionPapersEmail  appears three times in your post of the expression. Which one is highlighted? Did you add this field by finding it in the list of fields at the top left of the specify calculation dialog box and duoble clicking it? (That makes sure the exactly correct field name reference is entered.)

                    If the value list's name is "Mailing History", then the expression should be:

                    If ( IsEmpty ( FilterValues ( valueListItems ( get ( FileName ) ; "Mailing History" ) ; "2010 mailing" ) ) ;
                         List ( Contact Management::DiscussionPapersEmail ; "2010 mailing" ) ; Contact Management::DiscussionPapersEmail )

                    Did you copy and paste directly from your specify dialog box to here?

                    I suspect a missing ) or " but can't see where it is missing in what you posted here and a quick check by copy-pasting it into a specify field dialog to check the syntax doesn't reproduce the error...

                    From your posts, there appears to be some confusion over Fields and the values they contain. Sort Tag 4 is the name of a field, "2010 mailing" is the value, as I understand it, that you want selected in the checkbox field if the Sort Tag 4 field is not empty.

                    • 7. Re: copy data from text field to checkbox
                      DavidCKantor

                      Thanks for your patience. The code you have above when pasted into the dialog produces the error that "DiscussionPapersEmail" field cannot be found. It is of course a checkbox within the list "Mailing History". It does not appear in the list at the left in "Specify Calculation" dialog.

                      • 8. Re: copy data from text field to checkbox
                        DavidCKantor

                        A Clarification:

                        attached image "sort tag 4" that currently holds info "Mailing History" field contains list of values "Mailing History" (could this duplicate name be a problem) which list includes value "DiscussionPaperEmail" that I want checked for each record found in the search for "*" in "sort tag 4"

                        • 9. Re: copy data from text field to checkbox
                          philmodjunk

                          As I was beginning to suspect, you are confusing the name of a field with the data it holds--which produces the error you see becaure there is no field in your database named DiscussionPapersEmail.

                          Before I post a copy with your exact field names and data, please open Manage | value lists and find the name of the value list used to produce the list of check boxes shown in the Mailing History field.

                          Also, for the record shown above, what check box should be selected by this process? "2010 mailing"--what you originally specified, is not a checkbox value shown in that field.

                          I've also assumed that the same exact value would be selected in Mailing History for every record f ound to have data in tje sort tag 4 field. I now suspect you want to select the value in the checkbox group that matches the text entered into sort tag 4. In this case, that would appear to be that DiscussionPapersEmail would be selected for this record and suggests that other records might need to have different values selected here.

                          • 10. Re: copy data from text field to checkbox
                            DavidCKantor

                            Value list is "Mailing History"

                            The checkbox should be "DiscussionPapersEmail" we can completely dispense with the "2010 mailing" entry

                            The search you suggested correctly finds all the records I need to modify and ALL RECORDS from that search can have the same checkbox checked in this process

                            thanks

                            • 11. Re: copy data from text field to checkbox
                              philmodjunk

                              The field is named Mailing History from what is shown on your layout. The value list has the same name as the field? (have to be sure here.)

                              So all will have "DisscussonPapersEmail" selected?

                              Is DisscusionPapersEmail selected in any of these records already?

                              Most of the complexity here is to avoid selecting that value a second time if it's already selected. If that's not a concern, we can use a much simpler expression.

                              • 12. Re: copy data from text field to checkbox
                                DavidCKantor

                                The field is named Mailing History from what is shown on your layout. The value list has the same name as the field? (have to be sure here.)

                                YES, BOTH ARE THE SAME

                                So all will have "DisscussonPapersEmail" selected?

                                CORRECT

                                Is DisscusionPapersEmail selected in any of these records already?

                                NO

                                Most of the complexity here is to avoid selecting that value a second time if it's already selected. If that's not a concern, we can use a much simpler expression.

                                • 13. Re: copy data from text field to checkbox
                                  philmodjunk

                                  I really like that last answer as we can dispense with most of the calculation and just use:

                                  List ( Contact Management::MailingHistory ; "DiscussionPapersEmail" )

                                  • 14. Re: copy data from text field to checkbox
                                    DavidCKantor
                                     Thanks so much for your help. I just tried: If ( IsEmpty ( FilterValues ( valueListItems ( get ( FileName ) ; "Discussion Papers Email" ) ; "DiscussionPapersEmail" ) ) ;      List ( Contact Management::Mailing History ; "DiscussionPapersEmail" ) ; Contact Management::Mailing History ) And it worked. If not neccesary though I'll certainly try out the briefer one you posted. Thanks so much for sharing your knowledge.
                                    1 2 3 4 Previous Next