colton 13 Posted May 3, 2013 Report Share Posted May 3, 2013 What is the best way to take one comma separated variable and turn it into multiple different variables. Essentially I am running a csv file to show tempVar as next list item but not every list item has the same number of columns. This is what I have CSV Contact listtom,555-555-5555,123 Test Street Dallas Texas, testwebsiteurl.comsally,666-666-6666, 118 Test Drive Daytona Florida, (no website)hank, 111-111-1111, 5454 Test Ave Seattle Washington, (no website)linda, 222-222-2222, 432 Test Lane Denver Colorado, lindaswebsiteexample.com This is what I am trying to do add list to list{contactList}{list from file .csvfile} loop total contactList set tempVar {next list item {contactList}} separate tempVar into nameVar,phoneVar,addressVar,webVar(if it exist) perform task Quote Link to post Share on other sites
UBotDev 276 Posted May 3, 2013 Report Share Posted May 3, 2013 Make your life easier and read this as UBot table. Once you'll have table loaded, 1st column will always be name, 2nd one phone, ..... Then just increment row and you'll get through csv that way. Quote Link to post Share on other sites
colton 13 Posted May 3, 2013 Author Report Share Posted May 3, 2013 How do you set a csv to table? I am still new to ubot and haven't really used tables. This definitely sounds easier. Quote Link to post Share on other sites
nuc63 27 Posted May 3, 2013 Report Share Posted May 3, 2013 Create table from file Quote Link to post Share on other sites
colton 13 Posted May 7, 2013 Author Report Share Posted May 7, 2013 Ok, set everything up as a table. Much better. Now from here, is there some type of Next Cell or Next Row command just like in a list? Like "next list item" but for tables. Do I need to convert the table into separate list or is there a better way to do this? Thanks for all the input. Quote Link to post Share on other sites
VaultBoss 310 Posted May 7, 2013 Report Share Posted May 7, 2013 You can refer to data in a table cell, specifically. As with lists, it is always better to refer directly the element, rather than indirectly... in other words, do not use $next list item, but $list item instead. To do so, you will have to loop through the list, using an indexing counter (of elements = rows in the case of lists, or in case of tables, either rows OR columns)Lists are, basically tables, but with a one dimension (a single row of data) So to access a table cell, you will need a looping indexing variable for looping the rows OR columns, whichever you prefer, in the first place, then a second variable, to point to the other dimension (rows -> cols, or cols -> rows, respectively) to pinpoint the specific cell. Hope this helps... Quote Link to post Share on other sites
colton 13 Posted May 7, 2013 Author Report Share Posted May 7, 2013 I tried that but I keep getting errors. Essentually I have...... loop{table total rows} type texttext areaText to Type: Table Cell {list} Row {counterVariableincreases} Column 1 Getting Script Error string to integer. Does the "table cell" row and column store names or positions? Should be position on table right? Quote Link to post Share on other sites
UBotDev 276 Posted May 7, 2013 Report Share Posted May 7, 2013 I think you are trying to use string as column or row #. why do you use list there? use the code bellow: type text(<tagname="input">, $table cell(&table, #ROW, 1), "Standard") and make sure that variable #ROW is a positive integer. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.