This may seem relatively simple, but I'm pretty confused. I have written a mapbasic tool that does things to the table 'Selection' depending on user choices in a popup menu, but currently you need to use the select too to select an item and then run the program. I was wondering how I'd go about selecting an object with a click then it instantly running the main part of the tool?

Thanks, Alan

  • I have modified the code in the MapBasic reference guide (as I will only be working with points), however I've gone wrong somewhere as when I click on any point it selects all points in the table! Here is what I have: pastebin.com/4Ee1BdUd – Alan Carr May 21 '13 at 14:13

Build your SQL statement at runtime:

comm = "Select * from "+s_table+" where rowid ="+i_row_id+" into Selection" 
Run Command comm
| improve this answer | |

Or just:

Select * from s_table 
   Where rowid = i_row_id 
   into Selection  
| improve this answer | |
  • I'm thinking that this was probably intended as a Comment on another Answer rather than an Answer in its own right. – PolyGeo May 23 '13 at 8:28
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – PolyGeo May 23 '13 at 8:29
  • Well, my answer is another of doing it. The first answer does it using a string built at runtime but it can also be done using a select statement without involving the Run Command statement – Peter Horsbøll Møller May 23 '13 at 10:12
  • My apologies - I'm not sure where that second comment attributed to me came from but it seems to have been system generated - and I don't think the first (somewhat similar) Answer was there when I reviewed yours and thought it was out of context. By way of apology I'll upvote your answer. – PolyGeo May 23 '13 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.