9 Replies Latest reply on Jul 9, 2012 11:29 AM by JoeMintz

    Variable Problems?

    JoeMintz

      Title

      Variable Problems?

      Post

      So I cannot tell if this is a problem with my variable calculation, or if it is a problem with the plugin.  Considering it uses the 360Works Email plugin, I don't think it would be an issue with it, since it seems to be updated very often.  So i'm blaming me, human error :).

      What I have been doing is, first I set a loop so that it grabs 1 field, the same field, which is the raw data URL from the container, and sets it up in the variable.  This is the calculation:

      Set Variable [$List ; List ( $List ; "EmailAttachFile( "&"\""&Documents::_c_RawData URL&"\""&" ) and" )]

      It appears to get the data correctly, because I have it set a random field just to make sure.  So I setRandomField $List, and it displays what I have gathered from the records:

      EmailAttachFile( "http://url1" ) and
      EmailAttachFile( "http://url2" ) and
      EmailAttachFile( "http://url3" ) and
      When I run the following script, it nothing happens however (I took out the email information for privacy):
      EmailSetBody( "This is the body of the email" ; "plain" ) and 

      $List

      EmailSend and

      EmailDisconnect
      BUT, when I run the following script, it works perfectly:
      EmailSetBody( "This is the body of the email" ; "plain" ) and 
      EmailAttachFile( "http://url1" ) and
      EmailAttachFile( "http://url2" ) and
      EmailAttachFile( "http://url3" ) and
      EmailSend and

      EmailDisconnect

      Does anyone perhaps have any idea of what I am doing wrong?

        • 1. Re: Variable Problems?
          philmodjunk

          And is a logical operator used like this:

          A = B And C = D

          Which returns  the number 1 for "True" if A = B and C also = D. It returs the number 0 for "False" if this is not the case.

          & is the concatentation operator so that

          "Apple " & "Orange"

          produces: "Apple Orange"

          I think you are using And where you should be using &.

          • 2. Re: Variable Problems?
            JoeMintz

            "and" is correct here, as it works with that in there without the variable (and its what the 360works documentation tells you to use).  I just tried to replace the "and" with "&" and it results the same Frown

            • 3. Re: Variable Problems?
              philmodjunk

              This is the part that looks wrong to me:

              EmailSetBody( "This is the body of the email" ; "plain" ) and

              $List

              If this is an expression placed inside a FileMaker Calculation dialog, it should be:

              EmailSetBody( "This is the body of the email" ; "plain" ) &

              $List


              • 4. Re: Variable Problems?
                JoeMintz

                Hmm, if I add an & instead of "and" after that, it doesn't send the email, but results in a 1 instead of 0.  If I add & before and after the $List (and remove the "and" after plain), it sends the email, but not the attachments.

                • 5. Re: Variable Problems?
                  philmodjunk

                  I can tell you that you should replace all uses of And with & in the full expression that

                  EmailSetBody( "This is the body of the email" ; "plain" ) &

                  $List

                  is a part of.

                  I think I see the problem with $List. You are entering calls to the EmailAttachFile function into this variable. FileMaker only knows that there is text in this variable. It doesn't know to evaluate this to get the results returned by/produced by this function.

                  You may need to use evaluate ( $List ) in place of $List

                  to get the needed results.

                  • 6. Re: Variable Problems?
                    philmodjunk

                    And now that I think a bit more carefully, the and may indeed be the correct operator here--I'd have to be familiar with this plug in to be sure...

                    • 7. Re: Variable Problems?
                      JoeMintz

                      I think you are right about pulling in text and not evaluating.  I would put the evaluation part in, but I don't know how many attachments I will have, so that can't work that way.

                      Do you have any other ideas other than "Evaluate ($List)"?  (Is that a function?)

                      • 8. Re: Variable Problems?
                        philmodjunk

                        What I am suggesting is:

                        EmailSetBody( "This is the body of the email" ; "plain" ) and

                        Evaluate ( $List )

                        And evaluate is a function that you can look up in fileMaker help.

                        • 9. Re: Variable Problems?
                          JoeMintz

                          Sounds good, I will try that out when I get back to my filemaker computer.  Appreciate it.