Xbasic

a5_calendar_html Function

Syntax

html as C = a5_calendar_html(N year ,N month ,C days)

Arguments

html

The HTML markup for the rendered calendar layout.

year

The calendar year to display.

month

The calendar month to display. Valid values are 1 through 12.

days

Optional. A character string that specifies which days to highlight and any comments to display. Supply a comma delimited list of days (for example: 5,6,7). You can also specify a range of days (for example: 5-8) and you can put a comment in a calendar cell (for example: 5:comment). If you do not want to highlight any days, pass an empty string ("").

Description

Generates an HTML calendar layout for use in reports.

Discussion

The a5_calendar_html() function generates an HTML calendar layout for a specific year and month. The generated HTML is typically used in a report to print a calendar control showing a date value or a set of highlighted days. To use the function in a report, add an HTML Layout control to the report. Define a calculated field that calls a5_calendar_html(), and then place the calculated field inside the HTML Layout control. For example, you can generate a calendar for the month of the current report date and highlight the day for that date by using the year(), month(), and day() functions in the expression that you assign to the calculated field.

Example

' Generate an HTML calendar for the current date and highlight the current day.
calc1 = a5_calendar_html(year(date()), month(date()), "" + day(date()))

' Place calc1 in an HTML Layout control on the report to render the calendar.

Report Calendar Example

Calendar rendered using a5_calendar_html() in a report HTML Layout control.
Calendar rendered using a5_calendar_html() in a report HTML Layout control.

Comparison with A5_GETDATEHTML()

Both a5_calendar_html() and A5_GETDATEHTML() work with calendar displays, but they are used in different contexts and return different values.

a5_calendar_html() generates HTML markup for a calendar layout for a specific year and month. The return value is a character string containing HTML that is typically placed in an HTML Layout control in a report. You can highlight specific days, specify day ranges, and include comments in calendar cells by using the days argument.

A5_GETDATEHTML() displays an HTML calendar dialog that allows the user to select a date. The function returns the selected date as a character string. A5_GETDATEHTML() is primarily used in interactive desktop applications to prompt the user for a date value.

In summary, a5_calendar_html() is used to generate a static calendar layout (for example, in a printed report), while A5_GETDATEHTML() is used to display an interactive calendar dialog and return a single selected date.

Limitations

None.

See Also