9 Replies Latest reply on Jun 12, 2017 7:49 AM by philmodjunk

    Email subject line

    GJBDJC

      I know this is easier than I'm making it, but I cant seem to get it to work.

      I need the following to appear in my email subject line:

      Text.......... (space) Field 1 (comma) Field 2

       

      Invoices::Company & " " & Invoice Data::Item, gives me Field 1 (space) Field2

      But when I add the text in front and the comma, it stops working???

        • 1. Re: Email subject line
          fmpdude

          Screenshot would be helpful.

          • 2. Re: Email subject line
            GJBDJC

            email.jpg

            Need the subject line to read: New order for ABC Company, Product Name

            • 3. Re: Email subject line
              erolst

              GJBDJC wrote:

              Text.......... (space) Field 1 (comma) Field 2

               

              Invoices::Company & " " & Invoice Data::Item, gives me Field 1 (space) Field2

              But when I add the text in front and the comma, it stops working???

              You need to concatenate all components using the & operator, be they static text (a literal) or a field reference; some (admittedly excessive) formatting should make that clearer:

               

              "Some hardcoded text that you typed, with a trailing space "

              &

              Invoices Data::Company

              &

              " "

              &

              Invoices Data::item

              • 4. Re: Email subject line
                TomHays


                GJBDJC wrote:

                 

                I need the following to appear in my email subject line:

                Text.......... (space) Field 1 (comma) Field 2

                 

                Invoices::Company & " " & Invoice Data::Item, gives me Field 1 (space) Field2

                But when I add the text in front and the comma, it stops working???

                 

                The details of how you performed "when I add the text in front and the comma" are needed for us to troubleshoot.

                 

                It sounds like you need

                 

                "The text in front " & Invoices::Company & "," & Invoice Data::Item

                 

                Note that I put a space after the initial quoted text inside the enclosing quotes.

                 

                -Tom

                • 5. Re: Email subject line
                  TomHays

                  "New order for " & Invoices::Company & ", " & Invoice Data::Item

                   

                   

                  -Tom

                  • 6. Re: Email subject line
                    fmpdude

                    Yep, that should work.

                     

                    Just a syntax problem.

                    • 7. Re: Email subject line
                      jgroberg

                      Thanks folks, I'd been banging my head on a similar problem, and thanks to you both now I've got it working, is there a place I can school up on the syntax for inserting data into email tasks?

                      • 8. Re: Email subject line
                        TomHays

                        jgroberg wrote:

                         

                        is there a place I can school up on the syntax for inserting data into email tasks?

                         

                        The situation presented in this post is not an e-mail specific one.

                         

                        This is the way FileMaker calculations work in general.

                         

                        The syntax you are seeking is the FileMaker calculation formula syntax.

                         

                        FileMaker online help and the FileMaker Knowledge Base are starting points.

                         

                        There are also many third-party websites and books on learning FileMaker as well as video tutorials.

                         

                        I find also that just searching the web with a specific question, e.g. "How do I combine fields in FileMaker" works prettey well if I know enough about the correct terminology for the situation.  The idea is that you are usually not the first person to have the same question so you just need to find the answers that others were given before you.

                         

                        -Tom

                        • 9. Re: Email subject line
                          philmodjunk

                          Three potential issues to consider as you learn more about calculations and how you might use them to create email messages:

                           

                          1. If you just start typing into the "TO" or "Body" boxes in the send mail dialog, FileMaker assumes that you are entering text and puts the quotes around the text for you. Enter in some parenthesis or characters that might be operators, and the evaluation of your input can change to that expecting a calculated expression. I find it best to click the button with the black triangle to bring up the calculation dialog and enter it all as an explicit calculation from the start.
                          2. "New order for " & Invoices::Company & ", " & Invoice Data::Item is a calculation that refers to data from two (Presumably) related tables, Invoices and Invoice Data. Thus, context (which table occurrence is current as specified by which layout is current), the way that you have defined that relationship, and what data is present in the match fields used in the relationship will all affect how the calculation evaluates.
                          3. "Hard coding" calculations like this into the email step produces what I consider to be a "brittle" feature. Should your users decide that the subject and/or body needs to be modified, you the developer have to go in and redefine the calculation in order to change the message sent. There are ways to store the message "form text" or "boiler plate" in a text field that has "placeholders" that mark where and what data is to be inserted into it. The substitute function is then used to merge the contents of this text field with the data from your solution. This is much more complex, but allows authorized users to make at least minor edits to the message without requiring a developer to step in and make the changes.