首页 \ 问答 \ 从Google文档表单中订购电子表格中的列(Order columns in a spreadsheet from a google docs form)

从Google文档表单中订购电子表格中的列(Order columns in a spreadsheet from a google docs form)

你不能从一边到另一边移动表中的列,因为这样做会破坏表中的结构。 这是谷歌支持和/或帮助页面说的。

我的问题是,如果我在谷歌文档中创建一个。 我无意中创造了一个问题,我应该早些时候创建,然后将问题移到表单上。 该列不会在电子表格中移动。

所以我的表单电子表格现在看起来搞砸了。 有没有办法解决这个问题,而无需再次输入我的所有问题(89)。 我在表格中没有任何结果。 所以我正在寻找一个再生表选项,或类似的东西。


you can't move columns in the table from side to side, since doing so would disrupt the structure from the table. This is wat google support and/or help pages says.

My problem is that if i create a from in google docs. And i accidently create a question that i should of created earlier and then i move the question up the form. The column doesn't move in the spreadsheet.

So my form spreadsheet looks messed up now. Is there a way to fix this without typing all my questions(89) again. I don't have any results in the sheet yet. So i'm looking for a regenerate sheet option, or something like that.


原文:https://stackoverflow.com/questions/11205864
更新时间:2022-06-25 13:06

最满意答案

我不确定是否可以在不知道数组是如何构建的情况下回答问题。 一个问题是For-in循环变量是一个NSFastEnumerationIterator,因此它需要向下转换为你想要它的那种“东西”。 你可能已经这样做了,这只是为了将来的参考。

话虽如此,我制作了一些代码并将其分解了一下 - 也许它会指向正确的方向。

下面的代码通过.value读入所有节点,然后遍历快照并将每个子节点存储在数组中作为FDataSnapshot。 然后代码迭代该数组并从存储在数组中的每个快照打印“guardian”。

我还包括你的代码来打印guardianID,它也可以工作,所以我的猜测是问题在于如何最初填充数组或在此行中

用于self.guardians中的快照

因为快照是NSFastEnumerationIterator

let ref = self.myRootRef.child(byAppendingPath: "guardian_node")!

ref.observe(.value, with: { snapshot in

     if ( snapshot!.value is NSNull ) {
          print("not found")
     } else {

          var guardianArray = [FDataSnapshot]()

          for child in snapshot!.children {
               let snap = child as! FDataSnapshot //downcast
               guardianArray.append(snap)
          }

          for child in guardianArray {
               let dict = child.value as! NSDictionary
               let thisGuardian = dict["guardian"]!
               print(thisGuardian)

               //your code
               let guardianID = (child.value as? NSDictionary)?["guardian"] as? NSString
               print(guardianID!)
          }
     }
})

*这是Swift 3和Firebase 2.x,但概念是相同的。


I am not sure if the question can be answered without knowing how the array is built. One gotcha is the For-in loops variable is a NSFastEnumerationIterator so it needs to be downcast to what kind of 'thing' you want it to be. You may have done that so this is just for future reference.

That being said, I crafted up some code and broke it down a bit - maybe it will point you in the right direction.

The code below reads in all nodes by .value and then iterates over the snapshot and stores each child in an array as a FDataSnapshot. Then the code iterates over that array and prints the 'guardian' from each snapshot stored in the array.

I also included your code to print the guardianID and it works as well so my guess is the problem lies with how the array is being initially populated or in this line

for snapshot in self.guardians

as the snapshot is a NSFastEnumerationIterator

let ref = self.myRootRef.child(byAppendingPath: "guardian_node")!

ref.observe(.value, with: { snapshot in

     if ( snapshot!.value is NSNull ) {
          print("not found")
     } else {

          var guardianArray = [FDataSnapshot]()

          for child in snapshot!.children {
               let snap = child as! FDataSnapshot //downcast
               guardianArray.append(snap)
          }

          for child in guardianArray {
               let dict = child.value as! NSDictionary
               let thisGuardian = dict["guardian"]!
               print(thisGuardian)

               //your code
               let guardianID = (child.value as? NSDictionary)?["guardian"] as? NSString
               print(guardianID!)
          }
     }
})

*This is Swift 3 and Firebase 2.x but the concept is the same.

相关问答

更多
  • 既然你没有分享必要的代码,我会假设你正在做这样的事情: ref!.queryOrdered(byChild: "text").observe(.value, with: { (snapshot) in print("\(snapshot.value)") }) 在Firebase位置上执行查询时,会根据查询返回有关项目顺序的信息。 当您观察值事件时,快照将包含键,值和子级的顺序。 但是,当您将请求转换为snapshot.value属性时,必须将所有信息转换为字典。 每个孩子的关键字和价值都经历了这 ...
  • 按顺序执行每个请求可能不是最好的方法; 在开始下一个之前没有理由等待最后一个完成。 当然,诀窍是知道最后一个请求何时完成。 我通常只使用一个计数器: function getSomeStuff(numToGet, callback) { var obj = []; // accumulates the results var numDone = 0; // keeps track of how many of the requests have completed for (var n=0; n ...
  • 您可以观察位置的值以获取阵列。 let ref = FIRDatabase.database().reference().child("list") ref.observeSingleEventOfType(.Value, withBlock: { snapshot in if let objects = snapshot.children.allObjects as? [FIRDataSnapshot] { print(objects) } }) You can obs ...
  • 我不确定是否可以在不知道数组是如何构建的情况下回答问题。 一个问题是For-in循环变量是一个NSFastEnumerationIterator,因此它需要向下转换为你想要它的那种“东西”。 你可能已经这样做了,这只是为了将来的参考。 话虽如此,我制作了一些代码并将其分解了一下 - 也许它会指向正确的方向。 下面的代码通过.value读入所有节点,然后遍历快照并将每个子节点存储在数组中作为FDataSnapshot。 然后代码迭代该数组并从存储在数组中的每个快照打印“guardian”。 我还包括你的代码来 ...
  • 首先,你有'范围'的问题。 函数或回调内部声明的变量永远不能从该函数或回调的外部访问。 您的问题的一个解决方案可能是这样的: var results: [FIRDataSnapshot] = [] override func viewDidLoad() { super.viewDidLoad() leave.observeEventType(.Value, withBlock: { snapshot in self.results.append(snapshot.value) }) ...
  • 问题是由您订购代码的方式引起的。 执行行的顺序与您的想法不同。 如果你把它减少到这个,最容易看到这个: var firebaseRef = firebase.database().ref('Incidents'); console.log("Before database loading started"); firebaseRef.on('child_added', function(snap) { console.log("In child_added"); }); console.log("Af ...
  • 它看起来像你的数组从未初始化,所以self.array? 将始终跳过append 。 一种解决方案是检查数组是否存在: if (self.array?.append(math)) == nil { self.array = [math] } 有可能有更多的方法来解决这个问题,但我修改了这个问题的答案: 在Swift中将元素添加到可选数组中 更新 更简单的是在使用之前简单地创建数组: var array:[String]? var count: Int = 0 override func view ...
  • 正如你已经添加了mySnap.childSnapshot(forPath: "positions").value响应mySnap.childSnapshot(forPath: "positions").value在注释中它是Dictionary Array的类型,所以键入它为[[String: Any]] 。 let positions = mySnap.childSnapshot(forPath: "positions").value as? [[String: Any]] As you have ad ...
  • 尝试: var ref: FIRDatabaseReference! ref = FIRDatabase.database().reference() ref.child("users").observeSingleEvent(of: .value, with: { (snapshot) in if let snapshots = snapshot.children.allObjects as? [FIRDataSnapshot] { f ...
  • 我建议阅读使用数据列表,因为它解释了事件是如何工作的。 在这里深入研究一下你的代码是一些观察: 您正在使用ChildAdded事件和文档状态 每个现有子项触发此事件一次,然后每次将新子项添加到指定路径时再触发该事件。 因此,如果您有10个子节点,则该块将连续调用10次,每个子节点调用一次。 根据您的代码,它将尝试滚动每个不必要的子项。 有几种解决方案。 如果要加载一系列用户,则可以使用单个Value事件。 这将在所有节点中同时读取,然后您可以在节点上迭代,填充数据源(通常是数组),然后只需滚动到最后一个索引 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)