3 Replies Latest reply on Apr 9, 2013 12:27 PM by Matty_1

    Date formatting in a text merge field

    Matty_1

      Title

      Date formatting in a text merge field

      Post

           Please refer to the coding below, as you can see this is output as text.  Because I have to have this calculation in place inorder to properly display all the required information the dates are not formatted the way I want them even if I change the date settings in the merge field.  Is there and easy way around this?  I'm looking to have the date show as the following example:

           Tuesday, April 9, 2013

            

            

           Case (
            
           PaymentTerms = "Vendor Invoice Terms" ; "Payment will be issued based on the vendors invoice payment terms and will be paid via " & Lower (PaymentMethod) & "." ;
            
           PaymentTerms = "Immediately" ; "Immediate.  Payment will be issued via " & Lower (PaymentMethod) & " on " & PaymentDate & "." ; 
            
           PaymentTerms  ≠ "Vendor Invoice Terms" and "Immediately" ; PaymentTerms & " business days.  Payment will be issued via " & Lower (PaymentMethod) & " on " & PaymentDate & "." 
            
           )

        • 1. Re: Date formatting in a text merge field
          Matty_1

               Right after I posted I realized I had only tested the first two lines and not the last line which is "not equal to" (the not euqal to options are: 10, 15 and 30)  so note that there is a mistake in the coding.  Sorry about this, if someone knows how to get the same results for the last line let me know.  For some reason I always struggle with "and" & "or" functions.  Can't ever wrap my head around it.

          • 2. Re: Date formatting in a text merge field
            philmodjunk

                 Technically, this is a calculation field or a text field with an auto-entered calculation. Merge fields are something else.

                 You don't specify the format that you want, but there are a number of functions that can return the: Name of the day of the week, the name of the month, the number for the day, month and year. So you can use these functions to construct just about any textual representation of a date that you want. Here's one example and note the correct made to fix an error in your case function: (PaymentTerms  ≠ "Vendor Invoice Terms" and "Immediately" will not evaluate correctly.)

                 Case (
                  
                 PaymentTerms = "Vendor Invoice Terms" ; "Payment will be issued based on the vendors invoice payment terms and will be paid via " & Lower (PaymentMethod) & "." ;
                  
                 PaymentTerms = "Immediately" ; "Immediate.  Payment will be issued via " & Lower (PaymentMethod) & " on " & PaymentDate & "." ; 
                  
                 PaymentTerms & " business days.  Payment will be issued via " & Lower (PaymentMethod) & " on " & DayName (PaymentDate) &", " & MonthName ( PaymentDate ) & " " & Day ( PaymentDate ) & ", " & Year ( PaymentDate)  & "." 
                  
                 )
                  
                 Many other possible expressions can be used to produce a wide variety of dates.
            • 3. Re: Date formatting in a text merge field
              Matty_1

                   Thank you Phil!