显示过去24个月是否有上个月的限制?

2020-09-02 12:47发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


专家们,

我正在下拉菜单中尝试过去的24个月,并将上个月设置为默认值。 感谢 Mustafa Bensan 找到了以下脚本,但我无法按降序或限制对月份进行排序 值到24个月。 你们其中一个可以帮忙吗?

var curr_date = APPLICATION.getInfo()。dateNowInternalFormat;

var curr_year = curr_date.substring(0,4);
var curr_year_num = Convert.stringToInt(curr_year);
var curr_month = curr_date.substring(4,6);

var previous_month_key ="";
var month_key ="";

var years = [""];
years.pop();

var months = [" Jan"," Feb"," Mar"," Apr"," May"," Jun"," Jul"," Aug"," Sep"," Oct"," Nov" ," Dec"];

var curr_month_index = Convert.stringToInt(curr_month)-1;

如果(curr_month_index == 0){

curr_year = Convert.floatToString(curr_year_num-1," 0000");
curr_month_index = 12;

}

years.push(curr_year_num-1 +"");
years.push(curr_year_num-2 +"");

months.forEach(function(month,index){

如果(索引

{

month_key = curr_year + Convert.floatToString(index + 1.0," 00");
DROPDOWN_4.addItem(month_key,months [index] +"" + curr_year);
previous_month_key = month_key;

}

});

years.forEach(function(year,index){

months.forEach(function(month,index){

month_key =年+ Convert.floatToString(index + 1.0," 00");
DROPDOWN_4.addItem(month_key,months [index] +"" +年);

});

});

DROPDOWN_4.setSelectedValue(previous_month_key);

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


专家们,

我正在下拉菜单中尝试过去的24个月,并将上个月设置为默认值。 感谢 Mustafa Bensan 找到了以下脚本,但我无法按降序或限制对月份进行排序 值到24个月。 你们其中一个可以帮忙吗?

var curr_date = APPLICATION.getInfo()。dateNowInternalFormat;

var curr_year = curr_date.substring(0,4);
var curr_year_num = Convert.stringToInt(curr_year);
var curr_month = curr_date.substring(4,6);

var previous_month_key ="";
var month_key ="";

var years = [""];
years.pop();

var months = [" Jan"," Feb"," Mar"," Apr"," May"," Jun"," Jul"," Aug"," Sep"," Oct"," Nov" ," Dec"];

var curr_month_index = Convert.stringToInt(curr_month)-1;

如果(curr_month_index == 0){

curr_year = Convert.floatToString(curr_year_num-1," 0000");
curr_month_index = 12;

}

years.push(curr_year_num-1 +"");
years.push(curr_year_num-2 +"");

months.forEach(function(month,index){

如果(索引

{

month_key = curr_year + Convert.floatToString(index + 1.0," 00");
DROPDOWN_4.addItem(month_key,months [index] +"" + curr_year);
previous_month_key = month_key;

}

});

years.forEach(function(year,index){

months.forEach(function(month,index){

month_key =年+ Convert.floatToString(index + 1.0," 00");
DROPDOWN_4.addItem(month_key,months [index] +"" +年);

});

});

DROPDOWN_4.setSelectedValue(previous_month_key);

付费偷看设置
发送
4条回答
空代码
1楼 · 2020-09-02 13:17.采纳回答

下面的代码对我来说似乎很好。.请分享其他任何想法或改进。.

非常感谢大师。

var curr_date = APPLICATION.getInfo()。dateNowInternalFormat;
var curr_year = curr_date.substring(0,4);
var curr_year_num = Convert.stringToInt(curr_year);
var curr_month = curr_date。 substring(4,6);

var previous_month_key ="";
var month_key ="";

var prev_year = Convert.floatToString(curr_year_num-1," 0000");
var prev_year2 = Convert.floatToString(curr_year_num-2," 0000");

var months = [" Dec"," Nov"," Oct"," Sep"," Aug"," Jul"," Jun"," May"," Apr"," Mar"," Feb" ," Jan"];

var curr_month_index = 12- Convert.stringToInt(curr_month);

DROPDOWN_3.setSelectedValue(month_key);
months.forEach(函数(month,index){

如果(索引> curr_month_index)

{

month_key = curr_year + Convert.floatToString(index + 1.0," 00");
DROPDOWN_3.addItem(month_key,months [index] +"" + curr_year);
previous_month_key = month_key;

}

});

months.forEach(函数(月份,索引){

month_key =上一年+ Convert.floatToString(index + 1.0," 00");
DROPDOWN_3.addItem(month_key,months [index] +"" + prev_year);

});

months.forEach(function(month,index){

如果(索引<= curr_month_index)

{month_key = prev_year2 + Convert.floatToString(index + 1.0," 00");
DROPDOWN_3.addItem(month_key,months [index] +"" + prev_year2);

}

});

当学会了学习
2楼-- · 2020-09-02 13:11

请分享您正在使用的Lumira Designer或Design Studio的版本/SP吗?

小c菟菟
3楼-- · 2020-09-02 13:07

有任何帮助专家吗? 请告诉我是否有可能。

穆斯塔法·本山 Tammy Powlas ,请 Jeroen van der A 鸣谢。 您的帮助。

SKY徐
4楼-- · 2020-09-02 13:29

谢谢塔米,我们正在使用Lumira Designer 2.3

一周热门 更多>