Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have select Query that selects distinct value from a column. Is is possible to use these distinct values in my mapbasic program to make buttons and button labels?

More Info:

SQL Query : Select vendor from table_name ;

Now the selected vendors name are used to make buttons but I don't know how to get each row from table and put it in mapbasic variable. I am used to JAVA programming but don't know how it works in mapbasic. In java program we store the table in resultset and loop through it to get the row of column. I need to know how is it done in map basic. I read the mapbasic guide but could not get information about this kind of stuff.

share|improve this question
    
What buttons? Of course, if it is a text field, you can use the text. You can also use these for function name calls I guess. You'll need to expand on what you need to do. As a word of advice, in future, could you put as much information as you can in your questions, as it makes them easier to answer, and we're all here to help. –  Hairy Aug 17 '11 at 6:17
    
@Hairy I added more information and Thanks –  kinkajou Aug 17 '11 at 6:45

1 Answer 1

up vote 1 down vote accepted
Open Table "MyTab.tab" as MyTable interactive
or Select Vendor from MyTable as Vendor

Fetch First From MyTable 
Do While Not EOT(MyTable)
    strVendor = MyTable.Vendor
    ...do stuff (call program to make buttons?)
Fetch Next from MyTable

Fetch First From Vendor
Do While Not EOT(Vendor)
    strVendor = Vendor.Col1
    ...do stuff (call program to make buttons?)
Fetch Next from Vendor

etc, etc

share|improve this answer
    
Thanks For Answer –  kinkajou Aug 17 '11 at 8:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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