在处理程序函数内部我正试图存储并获取名为"theses"的数组数组的值:
var fact_list = [ ["Kennedy Inauguration", "politics", "tZwnNdFNkNklYc3pVUzZINUV4eUtWVWFSVEf"], ["Pericles’ Funeral Oration", "politics", "sdgrewaNkNklYc3pVUzZINUV4eUtW345ufaZ"], ["The Pleasure of Books", "culture", "1234rFszdgrfYc3pVUzZINUV4eU43usacd"], ["I Am The First Accused (Nelson Mandela)", "law", "34rsgadOsidjSZIswjadi95uydnfklsdks"] ]; function submit(e){ Logger.log("running submit(e)"); var numberOfItems = e.parameter.checkbox_total; var itemsSelected = []; // for each item, if it is checked / selected, add it to itemsSelected for(var i = 0; i < numberOfItems; i++){ if(e.parameter['checkbox_isChecked_'+i] == 'true'){ itemsSelected.push(e.parameter['checkbox_value_'+i]); } } var app = UiApp.getActiveApplication(); Logger.log("itemsSelected = " + itemsSelected); ScriptProperties.setProperties({'theses': itemsSelected}, true); var thesesArrays = ScriptProperties.getProperty('theses'); Logger.log("thesesArrays = " + thesesArrays); for (var i = 0; i < thesesArrays.lenght(); i++){ var thesesId = ScriptProperties.getProperty('theses')[i][2]; var thesesType = ScriptProperties.getProperty('theses')[i][1]; importTheses(target, thesesId, thesesType); } app.close(); return app; }
但是当代码得到行时for (var i = 0; i < thesesArrays.lenght(); i++){
我得到了一个错误,因为thesesArrays
它不是一个数组数组(正如我的意图),而是一个没有该lenght()
方法的对象.
我该如何解决这个问题?如何在ScriptProperties中存储和检索数组?