1 2 Previous Next 19 Replies Latest reply on Feb 19, 2011 2:46 AM by Mitch

    Combine Text Fields but remain editable

    Mitch

      Title

      Combine Text Fields but remain editable

      Post

      Hi

      With the Fiilemaker Pro 11 v3 updater now out fixing the printing over multiple pages issue, I now find myself having to change my database to cater for the fix.  

      Because of the issues with the previous version, I had two research text fields "Research_Text_A" and "Research_Text_B".  Each limited to a page to prevent the cutting of text and printed on two separate pages. Now, of course there is a fix.  

      I now need to combine these fields into one research field that can now print any number of pages.  But I need the field to be editable afterwards.  Which prevents me using the following calculation in a new research field:

      Research_Text_C =  If (not IsEmpty (Research_Text_A ) ; " " & Research_Text_A ) & If (not IsEmpty (Research_Text_B) ; " " & Research_Text_B)

      My preference is to create a new database that will import the values from "Research_Text_A" and "Research_Text_B" and combine them.  So, how do I combine the fields and keep the field editable afterwards?

      Add to this problem, that Research_Text_A and Research_Text_B fields both have a calculated value that will highlight certain text value based on a trigger.  So, I need the same script on any new research field.

        • 1. Re: Combine Text Fields but remain editable
          Sorbsbuster

          Why not Replace Field Contents in Research_A with a calculation: Research_A &"[return character]" & Research_B, then remove the field Research_B?

          Can't be undone, try on a back up, usual warnings...

          • 2. Re: Combine Text Fields but remain editable
            Mitch

            Thanks.  Works so far when its part of the import script, of course it applies to all records.  I will see how it goes.

            Is there any way you can eliminate the "return character" if Research_A as empty for particular records?   Otherwise the "return character' will be inserted into all the fields, even the empty ones....  Obviously the replace will have to be done one record at a time..?

            • 3. Re: Combine Text Fields but remain editable
              Sorbsbuster

              Replace the 'Replace...' calculation with

              Case (

              Research_A = "" ; "" ;

              Research_A & "<return> "

              )

              & Research_B

              -----

              "Obviously the replace will have to be done one record at a time..?" No - the 'Replace Field Contents...' function replaces the data in the selected field in ALL RECORDS IN THE FOUND SET.  IT CANNOT BE UNDONE.  So go easy...

              • 4. Re: Combine Text Fields but remain editable
                Mitch

                Thanks, I have the "Case" function working and the text formatted properly in a new calculated field that I have created "Research_Combined" to test it all. 

                Case ( Research_A = "" ; Research_B ;

                Research_A  &  "¶¶"  &  Research_B)

                Obviously being a calculated field I can not edit the new field.  My issue now is what is the best way to have the "Research_Combined" values transferred into the "Research_B" field that can be edited.  Keeping in mind I only want to keep Research_B field in the new database, and only wish to have the text from Research_A insert before it if there is data present.

                I am not sure if I am tackling this problem the correct way.  I am also not totally up with importing and creating loops....

                • 5. Re: Combine Text Fields but remain editable
                  Sorbsbuster

                  "I am not sure if I am tackling this problem the correct way" - Bad news: you're not.  Good news: it's even easier than you've made it.

                  Previous comment: "Replace Field Contents in Research_A with a calculation: Research_A  &"¶" & Research_B, then remove the field  Research_B"

                  You didn't need to create any calculation field, and your previous text-finding scripts etc would still work.  They only need to work on Research_A field, because it now has all the data.  You can edit it how you wish.

                  There's nothing to stop you doing this as part of the import, but I assume you will only do it once, so I wouldn't have bothered doing anything fancy.

                  Summary:

                  In your original file with two fields, find all records, click into Research_A, select Records -> Replace Field Contents, choose 'By calculation...', set the calculation to be the case statement, and go for it.

                  ***The 'Replace Field Contents...' function replaces the data in the  selected field in ALL RECORDS IN THE FOUND SET.  IT CANNOT BE UNDONE.   So go easy...****  (Do it on a copy of the file first.)

                  • 6. Re: Combine Text Fields but remain editable
                    Mitch

                    I think I will play around with the import script as see what happens....

                    • 7. Re: Combine Text Fields but remain editable
                      Sorbsbuster

                      Why are you bothering...?

                      In fact what are you importing?  I thought you had an FM11 file which now needed less features than before because of the FM11 upgrade.  I didn't realize that you had some new file from which you are trying to import data from an old file.

                      • 8. Re: Combine Text Fields but remain editable
                        PeterKnipschield

                        I am basically a noob at this. I have about 16 different fields I would like to combine into one editable text field. There is also additional text that has to go inbetween some of the field information also. What is the easiest way to do this, also all of the info is within one record right now.

                        • 9. Re: Combine Text Fields but remain editable
                          Sorbsbuster

                          Are you importing anything from one file to another, or are you modifying data in one file?

                          Although you don't need to, for safety's sake I'd create a 17th text field - call it ResearchNotesAll.

                          Let's say between the notes Research_B and Research_C you want to insert the text "--- Below are special notes ----".

                          - Find all records (or at least all that you want to do this for.  In your case that is only one record, this time, but it seems to me there's something missing in the design concept if you only need one record - unless you are just starting out and testing it?)

                          - Click into the field ResearchNotesAll

                          - Select from the Records Menu the option 'Replace field contents...'

                          - In the dialogue box select 'Calculation...'

                          - Insert the Case Statement calculation:

                          Case ( Research_A = "" ; "" ; Research_A & "¶¶" )

                          &

                          Case ( Research_B = "" ; "" ; Research_B & "¶¶" )

                          & "--- Below are special notes ----¶¶" &

                          Case ( Research_C = "" ; "" ; Research_C &  "¶¶" )

                          blah, blah..., 16 times.

                          - Select OK, etc and 'Replace' the contents.  It should have combined all 16 fields together and inserted the text between them.  By the way, FM has a limit how much text it can take in one text field, but it is pretty huge.

                          • 10. Re: Combine Text Fields but remain editable
                            PeterKnipschield

                            I am wanting to modify the data from one file/record. This function will be common in all of the records, but the information changes, so I need to make it generic and editable. I haven't used the Case function at all and am not sure what that does in this instance.

                            In a nutshell there are actually 9 text calculations that I want to bring into one big field and edit that then needs to be copied and pasted into email. Also, I should note I am using FM7.

                            • 11. Re: Combine Text Fields but remain editable
                              Sorbsbuster

                              Sorry - Ive got myself confused now.  I've just spotted that the poster changed from Mitch to Peter Knipschied.  You said that you had 16 fields, then 9, then one record, then you want it to apply to all records... my head's in a spin.

                              If you want to bring the contents of 9 text fields into 1 'big' text field, then the suggestion I made above will work.  Just change the field names to be yours.

                              It will perform that 'copy-join-paste into the Big Field' across every record in your found set.  The first record's Big Field will have the result of its concatonated 9 fields on it, the second record will have the result of its 9 fields, etc.

                              The Case function just checks to see if the first field contains any data.  If it does, it includes it in the Big Field and adds a couple of returns.  Then it checks if there is anything in the second field, and if so it adds it on to the end of the first data.  BUT that was the requirement of poster Mitch - I don't know if that is your requirement.

                              You won't need to copy and paste it into an e-mail - FM can do that for you.

                              I believe all the functions etc I described work in FM7.

                              • 12. Re: Combine Text Fields but remain editable
                                PeterKnipschield

                                Is the "replace" you mention a automatic action, or is it something that can be scripted to perform so the end user doesn't have an extra step.

                                Like I said I am still green. It's been a long while since I have had any training and I am real rusty at this so I might as well be a noob.

                                • 13. Re: Combine Text Fields but remain editable
                                  PeterKnipschield

                                  I just read through your notes and I got the function to work with the button and the extra field. SWEET! Thanks.

                                  • 14. Re: Combine Text Fields but remain editable
                                    Mitch

                                    I think I may have led you up the garden path i my poor explanation.  I have a database being used by a number of friends made on FMP11, it has Research_A and Research_B fields, both limited to one page of text, because of the multiple page print bug in FMP 11 v2.

                                    Now there is a fix in this in FMP 11 v3 update.  

                                    I now need to create a new version of my database so they can use it, and obviously import all their old records.  My new database has the import function working so far as it is the second version I have created for them, this will be the third.

                                    In the new version of my database I wish to keep Research_B and now make it capable of printing several pages of text, easily achieved already. I no longer need a Research_A and will remove it, however I need to place any data in Research_A into Reserach-B so as to not loose any data from the old version.  It does not bother me if this is done through either import or any other method....

                                    Research B on the new version obviously needs to remain an editable field. 

                                    1 2 Previous Next