Insert into Table

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Example)
 
(One intermediate revision by one user not shown)
Line 9: Line 9:
 
'''Index:''' refers to the position you want the row or column to be inserted. If an index of 1 is selected, and the insert is set to column, a blank column will be inserted for column 1.
 
'''Index:''' refers to the position you want the row or column to be inserted. If an index of 1 is selected, and the insert is set to column, a blank column will be inserted for column 1.
  
== Example ==
+
== Example 1 ==
  
 
<pre>
 
<pre>
Line 15: Line 15:
 
add list to list(%one, $scrape attribute(<href=w"http://www.fruitsinfo.com/*.php">, "innertext"), "Delete", "Global")
 
add list to list(%one, $scrape attribute(<href=w"http://www.fruitsinfo.com/*.php">, "innertext"), "Delete", "Global")
 
add list to table as row(&test1, 0, 0, %one)
 
add list to table as row(&test1, 0, 0, %one)
plugin command("TableCommands.dll", "insert into table", &test1, "Row", 3)
+
plugin command("TableCommands.dll", "insert into table", &test1, "Row", 0)
  
 
</pre>
 
</pre>
Line 24: Line 24:
  
 
[[File:insert.jpg]]
 
[[File:insert.jpg]]
 +
 +
 +
== Example 2 ==
 +
 +
Need to insert an item into a specific list position?
 +
 +
You can use the insert into table command to do just that.
 +
 +
<pre>
 +
navigate("http://listofrandomnames.com/index.cfm?generated", "Wait")
 +
wait(6)
 +
click(<type="submit">, "Left Click", "No")
 +
wait(6)
 +
add list to list(%names, $scrape attribute(<innertext=r"^(?<FirstName>\\w+)\\s(?<LastName>\\w+)$">, "innertext"), "Delete", "Global")
 +
add list to table as column(&editing, 0, 0, %names)
 +
plugin command("TableCommands.dll", "insert into table", &editing, "Row", 5)
 +
set table cell(&editing, 5, 0, "Manny Su")
 +
clear list(%names)
 +
add list to list(%names, $plugin function("TableCommands.dll", "$list from table", &editing, "Column", 0), "Delete", "Global")
 +
</pre>
 +
 +
 +
The position we want to insert the list item to is list position 5.
 +
 +
We then insert a blank cell, set the table cell value to the new value, which is the name Manny Sue, and then we clear the original list and create a new list from the edited table column

Latest revision as of 19:00, 9 September 2014

Insert into Table is a Data Command.

This inserts a blank row or column in front of a specified index (column or row number).

Table: refers to the table you would like to insert the column or row.

Insert: the drop down allows you to choose whether you want to insert a blank row or a blank column.

Index: refers to the position you want the row or column to be inserted. If an index of 1 is selected, and the insert is set to column, a blank column will be inserted for column 1.

[edit] Example 1

navigate("http://www.fruitsinfo.com/tropical-fruits.php", "Wait")
add list to list(%one, $scrape attribute(<href=w"http://www.fruitsinfo.com/*.php">, "innertext"), "Delete", "Global")
add list to table as row(&test1, 0, 0, %one)
plugin command("TableCommands.dll", "insert into table", &test1, "Row", 0)


Running the scripts will insert an empty row in the table above the populated row.


Insert.jpg


[edit] Example 2

Need to insert an item into a specific list position?

You can use the insert into table command to do just that.

navigate("http://listofrandomnames.com/index.cfm?generated", "Wait")
wait(6)
click(<type="submit">, "Left Click", "No")
wait(6)
add list to list(%names, $scrape attribute(<innertext=r"^(?<FirstName>\\w+)\\s(?<LastName>\\w+)$">, "innertext"), "Delete", "Global")
add list to table as column(&editing, 0, 0, %names)
plugin command("TableCommands.dll", "insert into table", &editing, "Row", 5)
set table cell(&editing, 5, 0, "Manny Su")
clear list(%names)
add list to list(%names, $plugin function("TableCommands.dll", "$list from table", &editing, "Column", 0), "Delete", "Global")


The position we want to insert the list item to is list position 5.

We then insert a blank cell, set the table cell value to the new value, which is the name Manny Sue, and then we clear the original list and create a new list from the edited table column

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox