Monday, December 6, 2010

Displaying a Holiday or Monthly Event in a Web Part

I created several custom lists that display a specific Holiday, Pay Dates, Birthday, Etc...
I now want this list to display as a web part and only display the "current month" activities.   After trying a few methods, I stumbled upon this calculated column to solve my issue.

  • First I created all the custom columns, including a Date Column (DateDisplay).  
  • Then I created a Calculated (calculation based on other columns) Column
  • Named it ItemDisplay
    • Made it a Content Type
    • Inserted the following formula: 
      • Calculated (calculation based on other columns)
        =IF(MONTH(Today)=MONTH(DateDisplay),"1","0")
      • Finally made the Data Type Return a Single Line of Text.
  • Next I added the web part, edited the current view
  • Place a filter on it so it shows only Items, "ItemDisplay" is Equal to 1
What the calculated value means
=IF the current Month of (Today) EQUALS the Month of (DateDisplay)
Then set the value to 1, if not then set it to 0
The Web Part filter will then display only items Equal to 1

EDITED: I haven't been able to make this process automated, but at the beginning of each month, I just edit the current months items, don't make any changes, just save the item and the formula will kick in and display the month as a 1.  Hope this makes sense.

1 comment:

  1. This just made my day so much easier!!! woah!

    ReplyDelete