Skip to main content

Search

Search

Use Vbscript To Complete Postgresql Query Using Inputbox Inside Select Statement

Comments

7 comments

  • Avatar
    Ian Cummings
    Moderator

    Why are you not using the built-in functionality of BarTender to connect to the database and use the queryprompt functionality to prompt the user at print time for the search criteria value?  Note that BarTender's database capability does also support custom SQL statements that may include the queryprompt reference in them if you wish.

     

    Take a look at these videos:

     

    https://www.youtube.com/watch?v=WUBXhAnhrMU

     

    https://www.youtube.com/watch?v=FRcASc2CnD4

    0
  • Avatar
    Legacy Poster

    Hi Ian, thanks for the reply.  I tried using the BT built in DB connection in conjunction with the query prompt, but I was unable to set the query prompt filters because I am using a custom SQL statement.  I thought this was unusual, so I called tech support and was told I cannot use the built in query prompt if I am using my custom SQL statement.  Was I informed incorrectly?  If so, how can I set the query prompt to search a specific column from my query?  You can set it by going to the "Filters" tab, but I don't have the "Filters" tab when I use a custom SQL statement.  

    0
  • Avatar
    Ian Cummings
    Moderator

    Yes, unfortunately you got incorrect information.  To view the syntax used for such query prompt references, create a database connect, build a query using a named query prompt, and then switch to the custom SQL view.  Example:

     

    SELECT `CONTCOMP` FROM `CUSTOMER` WHERE `CONTCOMP` = '?QueryPrompt1'

    0
  • Avatar
    Legacy Poster

    Yep, that was incredibly easy compared to what I was getting into.  Thanks a bunch for the insight.  I simply added "WHERE shiphead_number = '?ShipmentNumber' AND shipitem_qty = '?Quantity'".  These both allow me to prompt the operator for the shipment number and quantity prior to firing my query.  Thanks again!

    0
  • Avatar
    Ian Cummings
    Moderator

    Glad that worked out for you.  Trying to debug the VB script wouldn't have been fun for anyone... :)

    0
  • Avatar
    Ian Cummings
    Moderator

    FYI: BarTender 2016 R3 now offers native support for PostgreSQL databases: http://www.seagullscientific.com/support/service-releases-legacy-versions/2016/

    0
  • Avatar
    Legacy Poster

    Awesome!  Thanks for the update.  I am going to check out the new features today.  

    0

Please sign in to leave a comment.