add month/year to drop-down list box
Posted KIKI_FAN
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了add month/year to drop-down list box相关的知识,希望对你有一定的参考价值。
add month/year to drop-down list box
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;
以上是关于add month/year to drop-down list box的主要内容,如果未能解决你的问题,请参考以下文章
不在 GROUP BY 中,包含 DAY、MONTH、YEAR [重复]