我需要填充一系列标题为 M0、M1、M2 等的列。下面是我已经制定出的长期逻辑,但现在我想简化代码。了解我如何首先计算两个日期字段之间的月份,以了解要填充哪一列。
if intck('month', start_dt, today_dt) = 0 then M0 = "Blue";
if intck('month', start_dt, today_dt) = 1 then M1 = "Blue";
if intck('month', start_dt, today_dt) = 2 then M2 = "Blue";
从概念上讲,我宁愿在一行代码上做这样的事情:
"M"||intck('month', start_dt, today_dt) = "Blue";
所以我想“计算”正确的列名称。
感谢您的帮助!
这就是 ARRAY 的用途。
array month [0:3] m0-m3;
month[intck('month', start_dt, today_dt)]= "Blue";