Hi,
I want to generate Calendar.
I have 2 fields, month and year, If I select any( month,year) then that corresponding Calendar must be displayed in the grid format.
Can u please tell me , how can I implement this calendar?
Thanks In Advance
Aswini
Discussion posts and replies are publicly visible
Hi Aswini, Do you still have the code for the above calendar you created. If so can you please send it to me.
Hai Bala, Do you have code for Calendar? If Yes Please share me the code
Hi Dara Raghuveer Prasad Meena,
Do you still have the code for calendar? can you please send me.
If any of you have code please share with me. asap
share the code if you got it
community.appian.com/.../calendar-template
you can use plug-in & and i have code also
here is the code : -
{ a!localVariables( local!year: year(today()), local!month: month(today()), local!date: day(today()), local!curD:today(), local!darkMode: true(), local!sampledate:a!refreshVariable( value: date(local!year,local!month,local!date), refreshOnVarChange:local!date ), local!displayMonth: { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" },
local!weekDay: weekday(day(local!year, local!month, 1)) - 1, { a!sectionLayout( /*label: "Sectionnnn",*/ contents: { a!cardLayout( contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: { a!richTextIcon( icon: "calendar" ), " Calendar" }, size: "MEDIUM_PLUS", style: { "STRONG" } ) } ) } ) } ) }, height: "AUTO", style: "TRANSPARENT", shape: "ROUNDED", marginAbove: "LESS", marginBelow: "MORE", showBorder: false, showShadow: true, decorativeBarPosition: "BOTTOM", decorativeBarColor: rule!PK_GenericColorConfig( Key: { "calenderColor", "bgCurrentDate" }, darkMode: ri!darkMode ) ), a!cardLayout( contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextIcon( icon: "angle-double-left-bold", link: a!dynamicLink( label: "Prev Year", value: local!year - 1, saveInto: local!year ), linkStyle: "STANDALONE", color: "#434343", size: "MEDIUM_PLUS" ) }, align: "CENTER", marginAbove: "NONE", marginBelow: "NONE" ) }, width: "EXTRA_NARROW" ), a!columnLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: {
a!richTextIcon( icon: "angle-double-left-bold", link: a!dynamicLink( value: if(local!month = 1, 12, local!month - 1 ), saveInto: if( local!month = 1, { a!save(local!year, local!year - 1), local!month }, local!month ) ), linkStyle: "STANDALONE", color: "#434343", size: "MEDIUM" ), " ", a!richTextItem(text: "MONTH", style: "STRONG"), " ", a!richTextIcon( icon: "angle-double-right-bold", link: a!dynamicLink( label: "Next year", value: if(local!month = 12, 1, local!month + 1 ), saveInto: { if( local!month = 12, { a!save(local!year, local!year + 1), local!month }, local!month ) } ), linkStyle: "STANDALONE", color: "#434343", size: "MEDIUM" )
}, align: "CENTER", marginAbove: "LESS" ) /*a!dropdownField(*/ /*label: "",*/ /*labelPosition: "ABOVE",*/ /*placeholder: "--- Select a Value ---",*/ /*choiceLabels: local!MonArr,*/ /*choiceValues: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12},*/ /*value: local!month,*/ /*saveInto: {local!month},*/ /**/ /*searchDisplay: "AUTO",*/ /*validations: {}*/ /*)*/
}, width: "NARROW_PLUS" ), a!columnLayout( contents: { a!richTextDisplayField( value: {
a!richTextItem( text: { upper(index(local!displayMonth, local!month, {})), " ", local!year
}, size: "MEDIUM", style: "STRONG" )}, align: "CENTER" ) }, width: "MEDIUM" ), a!columnLayout( contents: {
}, width: "NARROW" ), a!columnLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextIcon( icon: "angle-double-right-bold", link: a!dynamicLink( label: "Next year", value: local!year + 1, saveInto: local!year ), linkStyle: "STANDALONE", color: "#434343", size: "MEDIUM_PLUS" ) }, align: "CENTER", marginAbove: "NONE" ) }, width: "EXTRA_NARROW" ) }, alignVertical: "TOP" ), a!columnsLayout( columns: { a!columnLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: { " Sun" }, color: rule!PK_GenericColorConfig( Key: { "calendarBgColors", "nameOfDay" }, darkMode: ri!darkMode ), style: { "STRONG" } ) }, align: "CENTER" ) } ), a!columnLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: { " Mon" }, color: rule!PK_GenericColorConfig( Key: { "calendarBgColors", "nameOfDay" }, darkMode: ri!darkMode ), style: { "STRONG" } ) }, align: "CENTER" ) } ), a!columnLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: { " Tue" }, color: rule!PK_GenericColorConfig( Key: { "calendarBgColors", "nameOfDay" }, darkMode: ri!darkMode ), style: { "STRONG" } ) }, align: "CENTER" ) } ), a!columnLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: { " Wed" }, color: rule!PK_GenericColorConfig( Key: { "calendarBgColors", "nameOfDay" }, darkMode: ri!darkMode ), style: { "STRONG" } ) }, align: "CENTER" ) } ), a!columnLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: { " Thu" }, color: rule!PK_GenericColorConfig( Key: { "calendarBgColors", "nameOfDay" }, darkMode: ri!darkMode ), style: { "STRONG" } ) }, align: "CENTER" ) } ), a!columnLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: { " Fri" }, color: rule!PK_GenericColorConfig( Key: { "calendarBgColors", "nameOfDay" }, darkMode: ri!darkMode ), style: { "STRONG" } ) }, align: "CENTER" ) } ), a!columnLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: { "Sat " }, color: rule!PK_GenericColorConfig( Key: { "calendarBgColors", "nameOfDay" }, darkMode: ri!darkMode ), style: { "STRONG" } ) }, align: "CENTER" ) } ) }, marginAbove: "NONE", spacing: "DENSE", stackWhen: { "NEVER" } ), a!cardLayout( contents: { a!forEach( items: enumerate(6), expression: a!columnsLayout( columns: a!localVariables( local!index: fv!item, local!week: weekday(date(local!year, local!month, 1)), local!totdays: daysinmonth(local!month, local!year), a!forEach( items: enumerate(7) + 1, expression: { a!columnLayout( contents: { a!cardLayout( contents: a!richTextDisplayField( value: a!richTextItem( text: { if( ((fv!item + 1 + local!index * 7) - local!week) <= local!totdays, if( local!index = 0, if( fv!index < local!week, null,
fv!item + 1 + local!index * 7 - local!week ), fv!item + 1 + local!index * 7 - local!week ), null ) }, size: "MEDIUM", style: "STRONG" ), align: "CENTER" ), link: a!dynamicLink( label: "Clickable", value: fv!item + 1 + local!index * 7 - local!week, saveInto: { local!date, a!save( ri!GridDate, date(local!year,local!month,local!date) ) } ), style: { if( ((fv!item + 1 + local!index * 7) - local!week) = day(today()), rule!PK_GenericColorConfig( Key: { "calenderColor", "bgCurrentDate" }, darkMode: ri!darkMode ), if( ((fv!item + 1 + local!index * 7) - local!week) = day(local!sampledate), "#7289da", rule!PK_GenericColorConfig( Key: { "calenderColor", "bgdateColor" }, darkMode: ri!darkMode ) ) ) }, shape: "ROUNDED", showBorder: false() ) } ) } ) ), alignVertical: "MIDDLE", spacing: "DENSE", stackWhen: { "NEVER" } ) ) }, height: "AUTO", style: rule!PK_GenericColorConfig( Key: { "bgColor", "bgCalendarColors" }, darkMode: ri!darkMode ), shape: "ROUNDED", marginBelow: "LESS", showBorder: false, decorativeBarPosition: "NONE", decorativeBarColor: "#f5ddf8" ) }, height: "AUTO", style: rule!PK_GenericColorConfig( Key: { "bgColor", "bgCalendarColors" }, darkMode: ri!darkMode ), shape: "ROUNDED", padding: "NONE", marginAbove: "NONE", marginBelow: "NONE", showBorder: false, showShadow: true, decorativeBarColor: "#1d659c" ) } ) } )}
a!localVariables( local!clicked, local!date, local!week: { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" }, local!months: { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec" }, local!month: month(today()), local!year: year(today()), local!space: a!forEach( items: enumerate( weekday(date(local!year, local!month, 1)) - 1 ), expression: " " ), local!dates: append( local!space, enumerate(daysinmonth(local!month, local!year)) + 1 ), a!sectionLayout( contents: { a!cardLayout( contents: { a!richTextDisplayField( value: { a!richTextItem( text: " CALENDAR ", color: "#f59b42", size: "LARGE", style: "STRONG" ) }, align: "CENTER" ) }, style: "INFO", shape: "ROUNDED", marginBelow: "STANDARD", showBorder: false() ), a!cardLayout( contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!cardLayout( contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!richTextDisplayField( labelPosition: "ABOVE", value: a!richTextItem( text: local!months[local!month] & ", " & local!year, color: "ACCENT", size: "MEDIUM_PLUS", style: "STRONG" ), align: "CENTER" ) } ), a!columnLayout( contents: { a!dropdownFieldByIndex( label: "Month", labelPosition: "ABOVE", choiceLabels: local!months, value: local!month, saveInto: { local!month, a!save( local!space, a!forEach( items: enumerate(weekday(1 / local!month / local!year, 1)), expression: " " ) ), a!save(local!dates, null()), a!save( local!dates, append( local!space, enumerate(daysinmonth(local!month, local!year)) + 1 ) ) } ) } ), a!columnLayout( contents: { a!dropdownField( label: "Year", labelPosition: "ABOVE", choiceLabels: 100 + enumerate(year(today())), choiceValues: 100 + enumerate(year(today())), value: local!year, saveInto: { local!year, a!save( local!space, a!forEach( items: enumerate(weekday(1 / local!month / local!year, 1)), expression: " " ) ), a!save(local!dates, null()), a!save( local!dates, append( local!space, enumerate(daysinmonth(local!month, local!year)) + 1 ) ) }, searchDisplay: "AUTO", validations: {} ) } ) }, alignVertical: "BOTTOM" ), a!cardLayout( contents: { a!cardLayout( contents: { a!columnsLayout( columns: { a!forEach( items: enumerate(length(local!week)) + 1, expression: a!columnLayout( contents: a!cardLayout( contents: a!richTextDisplayField( labelPosition: "ABOVE", value: { if( or(fv!item = 1), a!richTextItem( text: index(local!week, fv!item, ""), color: "NEGATIVE", size: "MEDIUM_PLUS", style: "STRONG" ), or(fv!item = 7), a!richTextItem( text: index(local!week, fv!item, ""), color: "POSITIVE", size: "MEDIUM_PLUS", style: "STRONG" ), a!richTextItem( text: index(local!week, fv!item, ""), size: "MEDIUM_PLUS", style: "STRONG" ),
) }, align: "CENTER", marginAbove: "NONE", marginBelow: "NONE" ),
shape: "ROUNDED", showBorder: true,
), ) ) }, marginBelow:"STANDARD" ) }, padding: "NONE", marginBelow: "NONE", showBorder: false ), a!cardLayout( contents: { a!forEach( items: enumerate( if( mod(length(local!dates), 7) = 0, quotient(length(local!dates), 7), sum(quotient(length(local!dates), 7) + 1) ) ), expression: a!columnsLayout( columns: { a!forEach( items: (fv!index - 1) * 7 + enumerate(7) + 1, expression: a!columnLayout( contents: a!cardLayout( contents: if( index(local!dates, fv!item, " ") = " ", a!richTextDisplayField( value: a!richTextItem( text: index(local!dates, fv!item, ""), size: "MEDIUM_PLUS" ), align: "CENTER" ), a!richTextDisplayField( value: a!richTextItem( text: index(local!dates, fv!item, ""), size: "MEDIUM_PLUS" ), align: "CENTER" ) ), showBorder: index(local!dates, fv!item, " ") <> " ", link: if( index(local!dates, fv!item, " ") = " ", null(), a!dynamicLink( value: index(local!dates, fv!item, " "), saveInto: {local!clicked, a!save(local!date,date(local!year,local!month,tointeger(local!clicked))) } ) ), shape: "ROUNDED", style: if( index(local!dates, fv!item, " ") = local!clicked, "#fc031c", if( and( index(local!dates, fv!item, " ") = day(today()), local!month = month(today()), local!year = year(today()) ), "#9dfc03", "NONE" ) ) ) ),
) }, alignVertical: "MIDDLE", spacing: "STANDARD" ) ) }, showBorder: false(), padding: "NONE" ),
} ) }, padding: "NONE", showBorder: true(), style: "ERROR" ) } ),
}, showDividers: true() ) }, shape: "ROUNDED", showBorder: true(), style: "STANDARD" ) } ))
HI Team,
It works all fine but fails at DEC 2024
is this fixed if Fixed can the you please shared me the Updated one
Hi Ne,I have attempted to resolve the issue, and this is the latest version of the code. Please take a look at it.
a!localVariables( local!clicked, local!date, local!week: { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" }, local!months: { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }, local!month: month(today()), local!year: year(today()), local!space: a!forEach( items: enumerate( weekday(date(local!year, local!month, 1)) - 1 ), expression: " " ), local!dates: append( local!space, enumerate(daysinmonth(local!month, local!year)) + 1 ), a!sectionLayout( contents: { a!cardLayout( contents: { a!richTextDisplayField( value: { a!richTextItem( text: " CALENDAR ", color: "#f59b42", size: "LARGE", style: "STRONG" ) }, align: "CENTER" ) }, style: "INFO", shape: "ROUNDED", marginBelow: "STANDARD", showBorder: false() ), a!cardLayout( contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!cardLayout( contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!richTextDisplayField( labelPosition: "ABOVE", value: a!richTextItem( text: local!months[local!month] & ", " & local!year, color: "ACCENT", size: "MEDIUM_PLUS", style: "STRONG" ), align: "CENTER" ) } ), a!columnLayout( contents: { a!dropdownFieldByIndex( label: "Month", labelPosition: "ABOVE", choiceLabels: local!months, value: local!month, saveInto: { local!month, a!save( local!space, a!forEach( items: enumerate(weekday(1 / local!month / local!year, 1)), expression: " " ) ), a!save(local!clicked, null()), a!save(local!dates, null()), a!save( local!dates, append( local!space, enumerate(daysinmonth(local!month, local!year)) + 1 ) ) } ) } ), a!columnLayout( contents: { a!dropdownField( label: "Year", labelPosition: "ABOVE", choiceLabels: 100 + enumerate(year(today())), choiceValues: 100 + enumerate(year(today())), value: local!year, saveInto: { local!year, a!save( local!space, a!forEach( items: enumerate(weekday(1 / local!month / local!year, 1)), expression: " " ) ), a!save(local!dates, null()), a!save( local!dates, append( local!space, enumerate(daysinmonth(local!month, local!year)) + 1 ) ) }, searchDisplay: "AUTO", validations: {} ) } ) }, alignVertical: "BOTTOM" ), a!cardLayout( contents: { a!cardLayout( contents: { a!columnsLayout( columns: { a!forEach( items: enumerate(length(local!week)) + 1, expression: a!columnLayout( contents: a!cardLayout( contents: a!richTextDisplayField( labelPosition: "ABOVE", value: { if( or(fv!item = 1), a!richTextItem( text: index(local!week, fv!item, ""), color: "NEGATIVE", size: "MEDIUM_PLUS", style: "STRONG" ), or(fv!item = 7), a!richTextItem( text: index(local!week, fv!item, ""), color: "POSITIVE", size: "MEDIUM_PLUS", style: "STRONG" ), a!richTextItem( text: index(local!week, fv!item, ""), size: "MEDIUM_PLUS", style: "STRONG" ), ) }, align: "CENTER", marginAbove: "NONE", marginBelow: "NONE" ), shape: "ROUNDED", showBorder: true, ), ) ) }, marginBelow: "STANDARD" ) }, padding: "NONE", marginBelow: "NONE", showBorder: false ), a!cardLayout( contents: { a!forEach( items: enumerate( if( mod(length(local!dates), 7) = 0, quotient(length(local!dates), 7), sum(quotient(length(local!dates), 7) + 1) ) ), expression: a!columnsLayout( columns: { a!forEach( items: (fv!index - 1) * 7 + enumerate(7) + 1, expression: a!columnLayout( contents: a!cardLayout( contents: if( index(local!dates, fv!item, " ") = " ", a!richTextDisplayField( value: a!richTextItem( text: index(local!dates, fv!item, ""), size: "MEDIUM_PLUS" ), align: "CENTER" ), a!richTextDisplayField( value: a!richTextItem( text: index(local!dates, fv!item, ""), size: "MEDIUM_PLUS" ), align: "CENTER" ) ), showBorder: and( index(local!dates, fv!item, " ") <> " ", index(local!dates, fv!item, " ") <> "", ), link: a!dynamicLink( value: index(local!dates, fv!item, " "), saveInto: { local!clicked, a!save( local!date, date( local!year, local!month, tointeger(local!clicked) ) ) }, showWhen: and( index(local!dates, fv!item, " ") <> " ", index(local!dates, fv!item, " ") <> "", index(local!dates, fv!item, " ") <> ";", ) ), shape: "ROUNDED", style: if( a!isNotNullOrEmpty(local!clicked), if( index(local!dates, fv!item, " ") = local!clicked, "#fc031c", if( and( index(local!dates, fv!item, " ") = day(today()), local!month = month(today()), local!year = year(today()) ), "#9dfc03", "NONE" ) ), "" ) ) ) ) }, alignVertical: "MIDDLE", spacing: "STANDARD" ) ) }, showBorder: false(), padding: "NONE" ), } ) }, padding: "NONE", showBorder: true(), style: "ERROR" ) } ), }, showDividers: true() ) }, shape: "ROUNDED", showBorder: true(), style: "STANDARD" ) } ) )
hi,
I have attempted to resolve the issue, and this is the latest version of the code. Please take a look at it."