MapInfo Pro Developers User Group

Welcome to the MapInfo Pro Developers community!  We are a group dedicated to the discussion and understanding of MapBasic and .Net MapInfoPro AddIn development. Bring your questions and ideas here. This group includes several members of the Pro development team from around the world.

Please feel free to start a discussion in the discussion tab or join in a conversation.

Product Information  Ideas Portal  MapInfo Community Downloads

Discussions

Members

Resources

Events

 View Only
  • 1.  Customize Point IndValue Default in Mapbasic

    Posted 02-21-2018 20:03

     

    Hello,

    I am writing a Mapbasic program that queries an ODBC database. I am just about finished but I ran in to one last issue. I need to do a thematic on one field that will have different field values with every query. My problem is I don't know how to make the fields variable. It could be anywhere from 1 to 8 different values and different for every query. This is an example of what the Mapbasic window produces.

     

    shade window 3044 1 with SOFTWARENAME values "TNL03164_7A_1" Symbol (34,16711680,12) ,"TNL03164_7B_1" Symbol (34,65280,12) ,"TNL03164_7C_1" Symbol (34,255,12) default Symbol (40,0,12) # color 1 # 

     

    The only thing I can think of is creating another SQL group by query but then I don't know how I would get the results into an array and worse yet I am not sure how I would make the VALUES section in the above line variable length. It's quite a dilemma.

     

    Thanks for your consideration,

     



  • 2.  RE: Customize Point IndValue Default in Mapbasic

    Employee
    Posted 02-23-2018 03:00

    Hi Martin

    A few comments that might help you get started.

    First, use the grouped query to get the list of unique values for you thematic. This also gives you an idea of the number of records.

    Then create a similar sized array of Symbols and assign symbols to each of them. You can also use a String array as you will combined it all together in a string later.

    Finally, do a loop around the number of unique values and build string where you combine the string with the symbols:

    For i = 1 To Ubound(arrStrings)

    If i = 1 Then

    sCmd = Chr$(34) + arrStrings(i) + Chr$(34) + " " + arrSymbols(i)

    Else

    sCmd = sCmd + ", " + Chr$(34) + arrStrings(i) + Chr$(34) + " " + arrSymbols(i)

    End If

    Loop

    And now you can use this string in combination with the rest of the Shade statement in a Run Command statement:

    Run Command "shade window 3044 1 with SOFTWARENAME values " + sCmd + " default Symbol (40,0,12)"