MapInfo Pro Developers User Group

Expand all | Collapse all

Dynamic Query from Dialog box

  • 1.  Dynamic Query from Dialog box

    Posted 07-29-2019 02:38
    Edited by Steven Graham 07-29-2019 02:39
    Hi I am trying to create a dialog where 1 to 3 values can be entered which is used to formulate a query. I seem to be getting issues and cant seem to figure out the correct way to do this.

    Firstly we search using Lot, Section and DP(Deposited Plan). One or more can be used to fine tune.

    Which searches using the values from the dialog (see below code)


    This produces an error and I am not sure how to evaluate the code as a query, what am I doing wrong?

    Any help would be greatly appreciated.

    ​​​​

    ------------------------------
    Steven Graham
    Software Architect and Distinguished Computer Engineer
    Tenterfield Shire Council
    ------------------------------


  • 2.  RE: Dynamic Query from Dialog box

    Posted 07-29-2019 04:10
    You have to add quotes around the string values in your query string.

    I can't quite see if all three columns are character columns or if one or two are numerical.
    But at least your PLANLABEL columns looks to hold characters.

    Change the expression for the character column to this structure:

    If srchDP <> "" Then
       SQL = SQL & "PLANLABEL=" & Chr$(34) & srchDP & Chr$(34)
    End If

    Chr$(34) returns a double quote (").

    Hope this helps

    ------------------------------
    Peter Horsbøll Møller
    Pitney Bowes
    ------------------------------



  • 3.  RE: Dynamic Query from Dialog box

    Posted 07-29-2019 19:02
    I knew there was something stupid i was doing yesterday afternoon. My whole life is in pieces at the moment so I've had a lot on my plate and the solution wasn't as obvious.

    Thanks for your help Peter, that seemed to work!

    ------------------------------
    Steven Graham
    Software Architect and Distinguished Computer Engineer
    Tenterfield Shire Council
    ------------------------------



  • 4.  RE: Dynamic Query from Dialog box

    Posted 07-30-2019 03:09
    You are welcome, Steven. I hope you are okay and that you get your life pieced together again.

    ------------------------------
    Peter Horsbøll Møller
    Pitney Bowes
    ------------------------------