Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8151697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:28:13+00:00 2026-06-06T15:28:13+00:00

I need help in a simple application based on Vaadin. I need to have

  • 0

I need help in a simple application based on Vaadin.

I need to have a table bound to SQL query results. SQL query has a parameter which value user chooses from combobox. What I need is to table be refreshed when user change the combobox value.

That is what I have ():

 Table table;
 JDBCConnectionPool pool;
 String query = "select products.product_code, products.name as product_name, clients.client_code,  clients.name as client_name from products, clients where products.client_id = clients.id";

 FreeformQuery q = new FreeformQuery(query, pool);
 SQLContainer container = new SQLContainer(q);
 table.setContainerDataSource(container);

So, this simple code selects all data from products and clients tables and puts it to the table. But how can I add filtering by clients.client_id selected from combobox, for example? To implement next query:

 select products.product_code, products.name as product_name, clients.client_code,  clients.name as client_name from products, clients where products.client_id = clients.id where client_id = ?;

Thank you for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:28:14+00:00Added an answer on June 6, 2026 at 3:28 pm

    You could add a Property.ValueChangeListener that would change your query parameters:

    comboBox.addListener(new Property.ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            String customQuery = query.replace(":clientId", ((Client)(event.getProperty()).getId(), pks);
            table.setContainerDataSource(new SQLContainer(new FreeformQuery(customQuery, pool)));
        }
    });
    

    And the query would hold the following value: select products.product_code, products.name as product_name, clients.client_code, clients.name as client_name from products, clients where products.client_id = clients.id where client_id = :clientId

    But be careful with query.replace, if Id is int there is nothing to worrier about, but if it is string, please addSlashes in order to avoid SQLInjection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to design a simple application which has to reside in the SIM
I need some help about RegExp in AS3. I have a simple pattern :
I have a simple (view-based) application. I want on tapping on custom UIView my
I need some help is MS SQL Server Query. I’m not much of a
Hi I am creating a simple calculation based application and at end i need
I have created a Zend based php application. I am looking for a simple
I need help setting up a simple C++/C# SWIG project. I am having a
I really need help on this one. I am having a simple login form
Im a javascript newbie and would need some help with this simple thing... I
I need some help to do a simple click in a listview item to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.