I am using the embedded Calendar for users to select a date. I am also disabling dates if they are before "today" or if a condition exists on a matching date record in a specific table.
I have it working correctly for "This month", but I am stumped as to where to put code defining the "disabled" dates when we navigate to a new month.
This is the code I use when we first initialize the calendar, and it works exactly as needed.
it defines the fields in the pointer arrary "V_DATE_EmbeddedCalendar.disabled.dates".
What I need to do is to redefine these fields and refresh the calendar when we navigate to another month.
I added the code in RED to the "<<code>>" section of the dialog which doesn't work.
Any assistance would be greatly appreciated.
Tom
I have it working correctly for "This month", but I am stumped as to where to put code defining the "disabled" dates when we navigate to a new month.
This is the code I use when we first initialize the calendar, and it works exactly as needed.
Code:
DIM SHARED V_DATE as D DIM end_month as N = day(month_end(date())) DIM SHARED varC_result as C DIM V_DATE_EmbeddedCalendar as P DIM V_DATE_EmbeddedCalendar.startWeekOnMonday as L DIM V_DATE_EmbeddedCalendar.disabled as P DIM V_DATE_EmbeddedCalendar.disabled.dates[end_month] as P dim tbl as P tbl = table.open("appt_control",FILE_RO_SHARED) tbl.index_primary_put("A_date") tbl.fetch_find(month_start(date())) dim j as N = 1 while tbl.a_date<=month_end(date()) dim tdate as D = {} if tbl.a_date<date() .or. tbl.date_closed tdate = tbl.a_date evaluate_template(evaluate_string("DIM V_DATE_EmbeddedCalendar.disabled.dates[{j}].date as D = \{{tdate}\}")) evaluate_template(evaluate_string("DIM V_DATE_EmbeddedCalendar.disabled.dates[{j}].ignoreYear as L")) j=j+1 end if tbl.fetch_next() end while tbl.close() V_DATE_EmbeddedCalendar.disabled.dates.resize(j-1)
What I need to do is to redefine these fields and refresh the calendar when we navigate to another month.
I added the code in RED to the "<<code>>" section of the dialog which doesn't work.
Code:
if a_dlg_button = "update_V_DATE_EmbeddedCalendar" then a_dlg_button = "" if V_DATE <> V_DATE_EmbeddedCalendar.date then V_DATE_EmbeddedCalendar.date = V_DATE end if [COLOR="#FF0000"]if month(v_date) <> month(date()) tbl = table.open("appt_control",FILE_RO_SHARED) tbl.index_primary_put("A_date") tbl.fetch_find(month_start(v_date)) dim j as N = 1 while tbl.a_date<=month_end(v_date) dim tdate as D = {} if tbl.date_closed tdate = tbl.a_date evaluate_template(evaluate_string("DIM V_DATE_EmbeddedCalendar.disabled.dates[{j}].date as D = \{{tdate}\}")) evaluate_template(evaluate_string("DIM V_DATE_EmbeddedCalendar.disabled.dates[{j}].ignoreYear as L")) j=j+1 end if tbl.fetch_next() end while tbl.close() V_DATE_EmbeddedCalendar.disabled.dates.resize(j-1) end if[/COLOR] end if
Tom
Comment