ZennoLab

Automate everything

用户工具

站点工具


侧边栏

本页面的其他翻译:

zh:table

这是本文档旧的修订版!


表格处理

为什么使用表格

  • 你有如下形式的数据文件要处理:
text
	login1;pass1;email1
	login2;pass2;email2
	login3;pass3;email3
	....

你每次执行项目都要从文件中取出一行,并且分别得到用户名密码和电子邮件。

  • 你需要访问.xls, .xlsx, .odt or. csv文件中的数据。
  • 你需要将项目中的数据保存成表格或EXCEL形式。

在哪里创建表格

可以在两个地方创建表格:

  1. 项目编辑器中,从工具栏可以拖动一个表格到编辑器窗口。
  2. 当录制带有个人档案和变量的树形项目时,可以右键点击空白区域创建表格。

设置表格

表格图标显示在编辑器底部,靠近个人档案设置和变量区域。编辑项目时,该图标位于项目树下。你可以修改表格名称,打开参数编辑窗口或者右键删除它。你可以手工添加表格数据,也可以从文件中加载。勾选“Load from a file”即可从文件中加载。如果你需要同步表格,只需勾选“Save changes of table to file”。另外还需要制定路径和分隔符。如果要处理的文件后缀是 .xls, .xlsx, .odt 或.csv,则分隔符无需指定。如果处理的文件后缀不是前面所说的,例如 .txt, 请勾选“Own format”并制定分隔符。

处理表格数据

使用“Table processing”指令访问表格数据,你可以取一行或者某一格,也可以添加、删除或者保存。表格的标记很简单,就像普通的Excel文档,列以拉丁字母命名,行以数字命名(从0开始)。\\注意:可以把表格中的某一行(例如用户名、密码和电子邮件)数据用“Take line”直接放到各自变量中。这种情况下,不用每个单元格单独读取。\\指定行数时可以使用区域

Restrictions and cautions

  • Do not create large files (hundreds of MBs), especially if you don't have enough RAM.
  • Table can not be fully synchronized with file (to save changes to a file) from a few projects with different separators. For instance, you have two different projects. You use the same file in both. But in the first project columns are separated by ';' and in the second by '-'. An error will occur in this case.
  • Restrictions with multithreading see below.

Multithreaded access to the samefile

If you run a project in multi-threading mode (with full synchronization of file with table), then no errors will occur while following a simple rule: handle a table in one action. For example, you need to take a line with removal. It will not be correct, if you take a line in one action and remove it in another one. This can be done in one action - set up tick “Remove after getting”. In one action can do almost everything you might need when working with a table.
If all projects only read a file, then there won't be any problem at all however would you handle a table.

Attention !!!

When you use sync tables with files ('save changes to file' is checked in table's settings), all your threads will use the same data and all actions which will affect changes in table will modify this table for every other thread.

If you don't use sync, every thread will operate with separate copy of initial table. And if you will use actions for deleting lines, for example, they will affect only 1 copy of this table within current thread.

If you use huge tables, make sure to use sync with files. Otherwise each instance will use a lot of RAM.

zh/table.1346481718.txt.gz · 最后更改: 2015/07/14 15:50 (外部编辑)