Creating a Custom Calendar

    Hi, Everyone!


    Today we gonna make a custom calendar:


    So, let's get started!

    For instance we have a field with dates during 2017 year called "PostDate".


    First of all we need to improve our data with some additional fields:



    Date(Num('01/01/2017') + IterNo() -1) as PostDate

    ,WeekName(Num('01/01/2017') + IterNo() -1) as WeekNum

    ,WeekDay(Num('01/01/2017') + IterNo() -1) as DayName

    ,MonthStart(Num('01/01/2017') + IterNo() -1) as MonDate

    ,Month(Num('01/01/2017') + IterNo() -1) as MonName

    AutoGenerate 1

    While Num('01/01/2017') + IterNo() -1 <= Num('31/12/2017');


    Now we have all needed fields to construct our calendar:


    The base for it is a Pivot Table object with two dimensions:


    1. if(MonDate=MakeDate(2017,vCurMonth,1),WeekNum)

    2. if(MonDate=MakeDate(2017,vCurMonth,1),DayName)


    Where "vCurMonth" is an integer variable which contains a month number.

    Note: this is very important to use exactly a variable (not a target fields w/o any if-conditions), because only this way will return to you a single value of picked date.


    After that you need to define one expression:

    1. day(only({1}PostDate))


    Now we have our table. For making it more similar of calendar pattern we need to drag dimension with day names to columns.


    And make some cosmetical things.

    On Presentation tab:

    1. Remove Null and Missing Symbols;

    2. UnCheck "Allow Pivoting";

    3. Expression values should be centered;

    4. Wrap Cell Text parameter is equal 2;


    Add Background color condition on Expressions tab:

    if(day(only({1}PostDate))=day(only({1}MonthEnd(PostDate))) or (day(only({1}PostDate))=day(only({1}PostDate)) and only({1}PostDate)=0)


    if(isnull(only(PostDate))=0 and GetSelectedCount(WeekNum)>0,RGB(100,180,100)




    The finishing line is to create a couple of text objects with Actions of variable changing - this will give an option to choose months.

    And pay attention to Clear button, because selected dates couldn't be unselected.


    I have picked months by this way:

    Pick(vCurMonth,$(=Concat({1}DISTINCT chr(39)&MonName&chr(39),',',MonDate)))


    You may choose other way, for instance - create a list of months as a simple filter.


    And of course, you can apply any other formats or visual clues by your taste and Client's request.


    Hope you liked it and if it so - please, don't be hesitate to give a rate to this document. Thank you!