Jump to content
UBot Underground

Selecting Table Row If Contains


Recommended Posts

I am reading in parameters into my bot by creating a table from a csv file

currently i have a ui box to tell which row to get the data from and the location of the file

 

If I tell what row to use it fills in all the fields on the various sites it visits

The problem with this is that I have to open up the csv file first to see what row the information is on

 

Each one of my clients has a numberic acount number like 14732 etc

What I want to do is put in the account number instead of the row number

 

Is there a way to search the csv file and it know which row the data is on using the contains command

 

 

Thanks in advance

Link to post
Share on other sites

I am currently struggling with a kind of similar problem and I was looking here in the forums for a method that can be used to identify on what row in a UI listbox that I have clicked in order to get an index instead of searching for it.

 

Anyway, what I have done is that I have a CSV file where each row contains a key-value pair, these are read into a table. I have a UI listbox that contains the keys (which are strings, e.g. "Wordpress", "Pligg" etc). In order to find the value part of the key-value pair, I am looping through my table and compare the key with what I am looking for. The problem is that I don't seem to always find the value part so I thought that there "should be" an index that I can use to get the info on what row of the UI box that has been clicked.

 

In your case, I guess you should be able to step through the table containing the data you are looking for and compare the key with the column where you have your key. When you have found it you get the row and should be able to get the relevant data out from that row.

 

If you have loads of rows in your table, then this probably take ages to find since the search is sequential. Then again, it's probably not likely that you have massive amounts of rows in a listbox.

Link to post
Share on other sites

Yes, loop through the column containing the account numbers by setting two variables (#row and #column) to 0. You will be searching table cells (not rows) for your desired account number. When it finds it it will already have the appropriate row stored in the variable (since you are incrementing the #row variable on each cycle). It;s a pretty simple process. Let me know if you need an example.

 

John

Link to post
Share on other sites

It's easy to accomplish that. All you need to do find out is what column of the table it resides. Now run a loop starting from 0 to total table rows. Put an If condition to check if the table cell content matches the UI input. If true then run another loop running on the row as that row and starting column 0 to total cells and make it do what you want to.

 

Praney

Link to post
Share on other sites

Staying consistent with how you layout your columns is key.

 

Also, not too many knew you could do this but you can use "$text length" to test the length of the cell itself. If it is Zero then maybe you need to add something or whatever your you are testing for. Lots of flexibility using this method with tables.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...