English (United States)
Call us! 512-349-0334 or (877) INDUSOFT

InduSoft Web Studio Forums

Find additional forum posts in in the Forum Archives. For assistance view the Forum Frequently Asked Questions.

Combo Box Filtering
Last Post 04 Feb 2019 02:27 PM by Joseph Zobac TX. 2 Replies.
Printer Friendly
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
ItsaMeUser is Offline
Basic Member
Basic Member

25 Jul 2016 11:06 AM
    I have a Combo Box that is reading from a database,

    I would like to add a filter to the Combo Box so it will only display values based on another part of the table.

    EX: using Microsoft SQL 2003

    My Combo Box is setup as follows

    Type: Database
    Connection String : Provider=SQLOLEDB.1; Integrated Security=SSPI; Initial Catalog=Mix; Data Source=PLANT-PC\SQLEXPRESS
    Table Name: Ingredient_Calibration
    Field: Ingredient

    however their is another column in the database that has the name Type. I would like to filter out the Combo Box based on the value of the Type element.

    I was hoping Indusoft used all these different fields and put together a string that read from the database, so all i would have to do is treat this field like the rest of the RecordSet String
    Table Name : Ingredient_Type Where Type = 'Ingredient_A'

    But this does not work, is there a way to complete what I am trying?

    Richard ClarkUser is Offline
    Forum Moderator
    Forum Moderator

    25 Jul 2016 12:24 PM
    Hello @NealMurray,

    You will need to perform any filtering in your query outside of the Combo Box. The object is designed only to show the results of a direct query to a column in a table.

    In order to do what you are suggesting, I recommend querying the database and putting the result into a text file, an intermediate database that the Combo Box can access, or into a string tag array. If you are a sophisticated SQL programmer, you can write the entire query into the connection string, or use a string tag to contain the connection string, however in any event you will need to create a new query for the database whenever you want to change the display list in the combo box.

    There are a variety of sample applications using various techniques in InduSoft Web Studio to create queries and return results in the Sample Applications. For instance, the application called "Database" uses ADO objects to create the connection in VB. Additionally, this blog discusses how to create intermediate data (for a text report) using a SQL Cursor. The output of the cursor could be used to populate a text file or a tag array for your Combo Box. http://www.indusoft.com/blog/2014/0...-database/

    Here is a blog about using an ad hoc query to access data in a database that might also be helpful. It has a sample application that may be useful to see how it is done. http://www.indusoft.com/blog/2013/0...eb-studio/

    Finally here is a blog and a sample application discussing how to get data from and back into a .csv (text) file that could be also useful for getting the aggregated list of values for your combo box. http://www.indusoft.com/blog/2013/0...b-studio/.

    I hope that you find this information useful. Also you can search the Corporate blogs and forums for more information (open the web pages of the blogs or the forums before entering your search strings so that the search will be pertinent to the blogs or the forms respectively) and also don't forget about our online training videos that discuss using and demonstrating the various InduSoft Web Studio functionalities. http://www.indusoft.com/Training/On...ing-Videos This may assist you in finding the best way to find an efficient solution for your problem.

    Richard Clark
    InduSoft TMS

    Joseph Zobac TXUser is Offline
    New Member
    New Member

    04 Feb 2019 02:27 PM
    Mr Clark,

    I also am having the same situation I have gotten the info from most all the links you listed above but the first link gives a custom 404 message like it is a dead link... Is there an alternative link to that information?

    You are not authorized to post a reply.