8 Replies Latest reply on Mar 10, 2008 11:59 AM by (John_Groh)

    Format Boolean Fields in Email

      Hi,

      I have alot of radio buttons and check boxes in a form on my site and the results need to be emailed. I want to convert the boolean numbers(0,1,2, etc) into "yes", "no", etc but dont know how to do it with the Send Email SB. I tried searching the old Interakt site with now luck. Anyone know how to do it?

      Thanks
      John
        • 1. Re: Format Boolean Fields in Email
          Günter Schenk Level 4
          Hi John,

          you can also use ADDT´s "Send page section by e-mail" behaviour, which also allows for sending "dynamic" content retrieved from a database.

          In your case you´ll probably need to pre-process the boolean values before "echoing" them within the page´s body -- and as PHP´s str_replace function can also be applied to an array of values, here´s how I´d do that:

          -------
          $pattern = array("0", "1");
          $replace = array('no','yes');
          $alias_variable = str_replace($pattern, $replace, $row_queryname['column_name']);
          --------

          ...where "$alias_variable" is what you´re going to "echo" in your page

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Format Boolean Fields in Email
            Level 1
            Hi Gunter,

            Thanks for the response. To be clear, I am using the Send Email to Recipients from Recordset SB and I have developed something similar to the "Orders Management" tutorial from Interakt. What Id like to do is that when someone in the admin view an order, they can change the "status" (of the order) from initiated, to processing, to completed. When they do that, I would like an email sent to the person that submitted the order letting them know the status has changed, however the status is stored as a number in the db.

            I have no idea on how to format that number into user friendly text in the generated email (sorry, your explanation didnt click for me) Can you help? Where do I put the code to use in the email?
            • 3. Re: Format Boolean Fields in Email
              Günter Schenk Level 4
              Hi John,

              all ADDT "send email" behaviours provide a Condition Builder in the "Advanced" tab -- in this case you could build a condition which will send the email only if the transaction field "status" equals 2 (or whatever value represents the status "completed")

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: Format Boolean Fields in Email
                Level 1
                Thanks again Gunter, but all I really want to do is have some text in the email saying, "Your status has changed to: xxxx" and instead of having the boolean number, I would like to replace that with text. So as close as I have come is this post from the old interakt site by someone else:

                "If Request.Form("FarnCustomLabel") = 0 Then
                Application("FarnCustomLabel") = "No"
                Else
                Application("FarnCustomLabel") = "Yes"
                End If

                Then, in your email, you could use {APPLICATION.FarnCustomLabel} to get the label."

                Keep in mind that is not my form and from what the post says, its in ASP.
                • 5. Re: Format Boolean Fields in Email
                  Günter Schenk Level 4
                  Hi John,

                  ------
                  Keep in mind that is not my form and from what the post says, its in ASP
                  ------

                  well, why has this been posted to the PHP Application Development forums then ? :-)

                  ADDT´s ASP VBScript Application Development are located here:
                  http://www.adobeforums.com/webx/.3bc390a0/

                  ...and I suggest to repost your question over there, as I can´t provide help for ASP related stuff

                  Cheers,
                  Günter Schenk
                  Adobe Community Expert, Dreamweaver
                  • 6. Re: Format Boolean Fields in Email
                    Level 1
                    Gunter,

                    No, that example I pulled from the old interakt site was in ASP, not my stuff!
                    • 7. Re: Format Boolean Fields in Email
                      Günter Schenk Level 4
                      Ah, sorry, that was just too confusing :-)

                      I think the most straight-forward solution would be to create 3 Send Email instances for that form -- with different lyrics, and with different Conditions:

                      1. Your status has changed to: initiated -- Condition: field equals 0
                      2. Your status has changed to: processing -- Condition: field equals 1
                      3. Your status has changed to: completed -- Condition: field equals 2

                      I´d personaly rather use such a string replacement routine as described before, but regretfully this seems impossible when using the Send Email behaviours the regular way

                      Cheers,
                      Günter Schenk
                      Adobe Community Expert, Dreamweaver
                      • 8. Re: Format Boolean Fields in Email
                        Level 1
                        No problem Gunter, thanks for your help. I will play around with it and if I come up with a solution, I will post it.

                        John