drop-down list添加日期
/* Add Month/Year to Card Expriry Month*/
Local Field &fld = GetField();
Local date &curDate = %Date;
Local date &endDate = AddToDate(&curDate, 5, 0, 0);
Local string &monYear;
&fld.ClearDropDownList();
/*
Local number &num = 1;
While &curDate <= &endDate
Local string &i = NumberToDisplayString("%", &num);
&monYear = DateTimeToLocalizedString(&curDate, "MMM/y");
&fld.AddDropDownItem(&i, Rept(Char(9), &num) | &monYear);
&curDate = AddToDate(&curDate, 0, 1, 0);
&num = &num + 1;
End-While;
*/
Local array of string &aryS_MthYr = CreateArrayRept("", 0);
While &curDate <= &endDate
/*y一定要小写,大写就不是"2017"这样的格式了,暂时不知原因,求解*/
&monYear = DateTimeToLocalizedString(&curDate, "MMM/y");
&aryS_MthYr.Push(&monYear);
&curDate = AddToDate(&curDate, 0, 1, 0);
End-While;
Local array of number &aryNbr_TabNumber = CreateArrayRept(0, 0);
Local number &nbrMaxValue = &aryS_MthYr.Len;
Local number &n;
For &n = 1 To &aryS_MthYr.Len
&aryNbr_TabNumber.Push(&nbrMaxValue);
Local string &i = NumberToDisplayString("%", &n);
&fld.AddDropDownItem(&i, Rept(Char(9), &aryNbr_TabNumber [&n]) | &aryS_MthYr [&n]);
&nbrMaxValue = &nbrMaxValue - 1;
End-For;