无法在Google Script中返回2D数组?(Can not return 2D Array in Google Script?)
我正在创建一个Google脚本来调查电子表格中的数据( 此处问题中的完整代码),并在调用Google脚本时收到此错误:
Uncaught Error: The script completed but the returned value is not a supported return type.
谷歌脚本试图返回一个二维数组 - 如何修复该函数,以便它成功地将二维数组传递回下一个Javascript函数?function handleFormSubmit() { var formObject = document.getElementById('text').value; google.script.run.withSuccessHandler(createTable).getSportData(formObject); } /** * Adds an html table */ function createTable(tableData) { console.log("The tableData for createTable() is " + tableData); var table = document.createElement('table'); var tableBody = document.createElement('tbody'); tableData.forEach(function(rowData) { var row = document.createElement('tr'); rowData.forEach(function(cellData) { var cell = document.createElement('td'); cell.appendChild(document.createTextNode(cellData)); row.appendChild(cell); }); tableBody.appendChild(row); }); table.appendChild(tableBody); document.body.appendChild(table); }
I am creating a Google Script to poll data from a spreadsheet (full code in the question here) and am getting this error when the google script is called:
Uncaught Error: The script completed but the returned value is not a supported return type.
The google script is trying to return a 2D array - how can I fix the function so that it successfully passes the 2D array back to the next Javascript function?function handleFormSubmit() { var formObject = document.getElementById('text').value; google.script.run.withSuccessHandler(createTable).getSportData(formObject); } /** * Adds an html table */ function createTable(tableData) { console.log("The tableData for createTable() is " + tableData); var table = document.createElement('table'); var tableBody = document.createElement('tbody'); tableData.forEach(function(rowData) { var row = document.createElement('tr'); rowData.forEach(function(cellData) { var cell = document.createElement('td'); cell.appendChild(document.createTextNode(cellData)); row.appendChild(cell); }); tableBody.appendChild(row); }); table.appendChild(tableBody); document.body.appendChild(table); }
原文:https://stackoverflow.com/questions/40787804
最满意答案
使用
LIKE
:select * from tableA ta join tableB tb on tb.description like '%' + ta.server_name + '%'
+
是SQL Server串联。 ANSI SQL有||
,而其他人则相反。扩展版本,在之前/之后添加空格:
select * from tableA ta join tableB tb on ' ' + tb.description + ' ' like '% ' + ta.server_name + ' %'
照顾Matt Gibson的测试/最好的例子。
Use
LIKE
:select * from tableA ta join tableB tb on tb.description like '%' + ta.server_name + '%'
The
+
is SQL Server concatenation. ANSI SQL has||
, and others haveconcat
instead.Extended version, add space before/after:
select * from tableA ta join tableB tb on ' ' + tb.description + ' ' like '% ' + ta.server_name + ' %'
Takes care of Matt Gibson's test/greatest example too.
相关问答
更多-
你不能like Linq加入like使用。 事实上,你不能like Linq like使用,只有像StartsWith , EndsWith或Contains这样的传统字符串方法。 你必须做这样的事情: var query = from f in db.form from n in db.name.Where(x => f.nameField.Contains(x.firstName)) ... You can't use like in a Linq join. In fact, ...
-
复杂SQL加入帮助!(Complex SQL Join help!)[2022-02-08]
@ ChaosPandion关于重新格式化的评论是一个好主意,但也许你需要一些帮助来理解什么是好的格式化。 嗯,这对每个人来说可能都不一样:-)但如果我正在编写你的查询,我会将其格式化如下: SELECT TOP (100) PERCENT a.Id, a.DateCreated, a.DateModified, a.LastUpdatedBy, a.AccomplishmentTypeId, ... -
SQL完全加入Where(SQL Full Join with Where)[2023-02-18]
试试这个: SELECT t2.[DATE] ,t1.[VENDOR] ,t1.[UPC] ,t2.[QTY] ,t2.[AMOUNT] FROM [STORESQL].[dbo].[VENDORS] t1 LEFT OUTER JOIN [STORESQL].[dbo].[REPORT] t2 ON t1.UPC=t2.UPC AND DATE='2011-11-8' WHERE VENDOR='119828' 针对DATE的where子句使您的外连接充当 ... -
更好地说明理论 What is SQL JOIN ? SQL JOIN is a method to retrieve data from two or more database tables. What are the different SQL JOINs ? There are a total of five JOINs. They are : 1. JOIN or INNER JOIN 2. OUTER JOIN 2.1 LEFT OUTER JOIN or LEFT JOIN ...
-
如何使用SQL JOIN(How to use an SQL JOIN)[2023-01-28]
如果没有与连接条件匹配的行,则左外连接将连接两个表并为JOIN中的第二个表返回空值。 之后,您只需在WHERE子句中指定一个过滤器,指示您只需要连接表记录为空的记录。 SELECT A.id FROM A LEFT JOIN B ON B.a_id = A.id WHERE B.a_id IS NULL A left outer join will join two tables and return nulls for the second table in the JOIN if there ... -
SQL - 加入问题(SQL - Join issue)[2022-01-30]
试试这种方式吧。 基本上,您将LEFT JOIN连接到由VehicleTypeCostsBreakdown和VehicleTypeCostsDepots之间的INNER JOIN形成的派生表。 只有当您满足所有条件时,INNER JOIN才会匹配。 SELECT rt.ID, rt.Name, rt.Rate, rt.Colour, vtb.ID AS 'vtbID', vtb.Value, rt.StdID FROM Rates AS rt LEFT OUTER JOIN Veh ... -
SQL与INNER JOIN不同(SQL Distinct with INNER JOIN)[2022-11-17]
而不是DISTINCT ,使用GROUP BY 。 见下文: $query_result = mysqli_query($db, "SELECT C.name FROM Category AS C INNER JOIN MarketProduct AS MP ON C.Category_ID = MP.ID_Category WHERE MP.ID_Market ='$id' GROUP BY C.name"); Instead of DISTINCT, use GROUP BY. See below ... -
sql join问题(sql join question)[2023-04-22]
尝试 select * from table1 inner join table2 on src=concat('node/',nid) 编辑 编辑以反映OP的变化 select `nid`, MAX(`timestamp`) as `timestamp`, `title` from `node_revisions` inner join `url_alias` on `src`=concat('node/',`nid`) group by `nid` ORDER BY `timestamp` DESC ... -
SQL - 加入包含(SQL - Join on contains)[2024-02-05]
使用LIKE : select * from tableA ta join tableB tb on tb.description like '%' + ta.server_name + '%' +是SQL Server串联。 ANSI SQL有|| ,而其他人则相反。 扩展版本,在之前/之后添加空格: select * from tableA ta join tableB tb on ' ' + tb.description + ' ' like '% ' + ta.server_name + ' %' ... -
SQL Join包含NULL值(SQL Join to include NULL values)[2022-05-01]
选择答案: SELECT O.OptionID,O.OptionName, Count(A.OptionID) AS Total FROM Options as O LEFT JOIN ( SELECT OPTIONID,USERID FROM Answers WHERE QuestionID = 1 ) AS A ON O.OptionID = A.OptionID LEFT JOIN Users as U ON A.UserId = U.UserID GROUP BY O.O ...