5 Replies Latest reply on Mar 27, 2014 3:20 PM by carnicelli

    Calculate Day of the week from a variable

    carnicelli

      Title

      Calculate Day of the week from a variable

      Post

           I have an Advertising Media Placement layout in appendix which I use to inform the number of insertions by day/moth/year.

           I'd like to know how can I create calculation fields above the numbers 1 to 31 in order to calculate and bring just de first letter of the "day of the week" as  (S, M , T, W ,T, F, S)  Each time I update de field  Mês de Veiculação.

           I tried in this way creating a calculation for each day but the results are not  accurate

           DayOfWeek ( Date ( 2 ; Mês ( Período Veiculação ); Year ( Período Veiculação ) ) )

            

      captura.png

        • 1. Re: Calculate Day of the week from a variable
          philmodjunk

               You mention one field by name, but use another in your calculation. I need more information about those two fields.

               Is Período Veiculação a field of type date? What kind of field is Mês de Veiculação and what type of data do you you set it to?

               Presumably, you have a way to identify the month and year, this could be a single date field or you might have two fields, one for the month and one for the year. Then, it would appear that you have up to 31 fields or 1 field with up to 31 related records to show the numbers 1 through 31 where you want letters for the days of the week.

               Please describe in more detail how you have set up that part of your layout.

          • 2. Re: Calculate Day of the week from a variable
            carnicelli

                 I'm sorry it was a bit confuse. 

                 The Field Label "veiculação" on the layout refers to  "(Período Veiculação)" on the table fields , and it set as Date.

            I realize that by mistake I used wrong format on the formula, since the correct syntax for DATE is  Month/Day /Year it's already fixed. but the out  put is still incorrect every time I updated  "veiculação" 

                 As soos as I can get the correct output I'm planning to replicate 31 times the same formula,  just changing the day as 1,2,3 ...31. 

            It was great if i could set all details to make it more intelligent and dynamic on february and other months that has more or less days than 31 but I'm just a baby on FM.

            Please let me know If I explained better now.

            • 3. Re: Calculate Day of the week from a variable
              philmodjunk

                   Left ( DayName ( Período Veiculação ) ; 1 )

                   will return the letter of the day name of the date in Período Veiculação.

                   To set up a series of calculations, you might use:

                   Left ( DayName ( Date ( Month ( Período Veiculação ) ; 1 ; Year ( Período Veiculação ) ) ) ; 1 )

              • 4. Re: Calculate Day of the week from a variable
                carnicelli

                     Phil,

                     By any unknown reason it did't work. 

                     See TEST Fields above the Layout with respectively with days 1, 2 and 3

                     I'm using exactly the syntax you gave me, just changing the day fied by 1,2,3...31

                      

                • 5. Re: Calculate Day of the week from a variable
                  carnicelli

                       I'm Sorry It was just the output format tha was on Data instead of Text.

                       Thank you very much again.