crazyflx 22 Posted December 21, 2009 Report Share Posted December 21, 2009 I'm looking to input different data on a form and all the data I need is in one CSV file. I need to be able to select certain data from one column for one field, and then another bit of data from that same line but in a different column for another field. Example: CSV File: lamp,desk,chair Fields Needed to Fill: What do You Sit in?: Chair (line 1, column 3)What Provides You with Light?: Lamp (Line 1, column 1)What's Your Lamp On?: Desk (line 1, column 2) Hopefully that makes sense.. Quote Link to post Share on other sites
Aaron Nimocks 19 Posted December 21, 2009 Report Share Posted December 21, 2009 You can do this. For loading from a CSV http://www.ubottutorials.com/basic-loading-from-csv-file.html Then what I would do is during the loop I would set a variable during that number in the loop. So if loop = 1 then set variable = "What provides you with light? $Current List Item" ect. If you are doing this on a small scale then this will work. Probably work on a large scale too but would have to be different if you have multiple rows. Should give you an idea how to do it though. Might be an easier way, just this is the first thought that came to mind. Quote Link to post Share on other sites
crazyflx 22 Posted December 21, 2009 Author Report Share Posted December 21, 2009 You can do this. For loading from a CSV http://www.ubottutorials.com/basic-loading-from-csv-file.html Then what I would do is during the loop I would set a variable during that number in the loop. So if loop = 1 then set variable = "What provides you with light? $Current List Item" ect. If you are doing this on a small scale then this will work. Probably work on a large scale too but would have to be different if you have multiple rows. Should give you an idea how to do it though. Might be an easier way, just this is the first thought that came to mind. That's great Aaron, thanks man! I sent you a PM (well, I tried to) and it didn't work so I sent you an email. Quote Link to post Share on other sites
Aaron Nimocks 19 Posted December 21, 2009 Report Share Posted December 21, 2009 That's great Aaron, thanks man! I sent you a PM (well, I tried to) and it didn't work so I sent you an email. Ya looks like PM's arent working. Will check my email in a bit. On my laptop watching my kids now. Quote Link to post Share on other sites
crazyflx 22 Posted December 21, 2009 Author Report Share Posted December 21, 2009 Alright, I'll tell you what I ended up doing and see if you think it was an alright way to do it. I had to do it this way because the CSV file I have has 30,000 rows in it and 3 columns and I needed to make sure it always selected data from the same row. I divided the CSV file into 3 seperate .txt files. I then created a "set parameter" that randomly selects a number between 1 and 30,000. Then, I set it to fill in a field with "list item 1" and it asks for a specific list location. I feed it the number that was randomly generated. Then, for field two, I fill that with "list item 2" and again it asks for a specific location, and I just feed it with the same number that was randomly generated. I tested it out, and it always gets data from the same row. Next loop around, it generates a new random number to use for all the fields...so on and so forth. Quote Link to post Share on other sites
crazyflx 22 Posted December 21, 2009 Author Report Share Posted December 21, 2009 I just realized you said "watching my kids on my laptop now"....?? Quote Link to post Share on other sites
Aaron Nimocks 19 Posted December 21, 2009 Report Share Posted December 21, 2009 I just realized you said "watching my kids on my laptop now"....?? Meaning I am in the living room playing with my kids and watching them. But I had my laptop so would browse around. Quote Link to post Share on other sites
crazyflx 22 Posted December 21, 2009 Author Report Share Posted December 21, 2009 Meaning I am in the living room playing with my kids and watching them. But I had my laptop so would browse around. Oh, haha, that makes sense. I thought you meant via a "nanny cam" or something. Did you happen to see my post directly above "I just realized you said "watching my kids on my laptop now"....??" that? Quote Link to post Share on other sites
Aaron Nimocks 19 Posted December 21, 2009 Report Share Posted December 21, 2009 Guess if that way works for you then its good. Really hard to visualize what you are doing to see if theres a better way. But if it works, then great. Quote Link to post Share on other sites
crazyflx 22 Posted December 22, 2009 Author Report Share Posted December 22, 2009 I'll upload the source code in a bit, just working on something at the moment. 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.