How to make a Grid editable that is bound to Query type Business Object

Hi

 

I have a requirement in which I have to give a search Form in which the End User will have options to input his own filter criteria, and based on his filter criteria I need to build the WHERE clause and populate the grid with the values fetched from database. Post which he should have an option to select few records and submit the form. The selected records should be updated.

 

Approach I followed: I created a Business Object with type as Query and the query string is:

EXEC('select a.PSNumber, a.Name from Resources_Data a '+@WhereClause) 

 

In the form I wrote a client script which builds the WHERE clause and pass it to the BO's query parameter, and the Grid gets populated based on the Fetched data. (Followed the approach suggested in http://metastorm.processmapping.com.au/post?Dynamic-SQL-for-grid-5410845&highlight=dynamic)

 

Now the Challenge is to Select few records from the fetched Data.

I am unable to make the Grid as editable as it is bound to BO of type Query. I can't change the BO type to Table as it has complex and dynamic where condition.

 

Please help me out in resolving this issue. I am unable to proceed further in this.

 

Thanks & Regards

Swetha.

 

Tagged:

Comments

  • You sound like your making your life harder than it needs to be ;)

    Editable grids are only read once on form load, so what you are trying to do, does not sound plausible in Metastorm.

     

    Instead you can keep what you have and then create the fields and an Add, Edit and Delete button below your grid. Show the add if no rows are selected or show Edit or Delete if a row is.  When Add is clicked you then can show data entry fields below and encode the Save to insert into the DB.  With the Edit you would show the same fields but populate with your selected row.

     

    All the buttons would be coded to handle the updates.  Just set the data business object to always refresh and the rest should be rather straigtht forward.

  • hi
    i'm not sure if this is solution of the problem. If you want only to allow user to select few rows before submit form (not edit them), you can make it like this:
    1) build query server or client side, there is no big difference
    2) prepate temporary table with needed columns + "selected" column
    3) prepare query almost like before but instead select make it INSERT INTO SELECT
    4) make on when user select row event script which will change value in select column

    if user will click on the row the row will be selected. you can make on "selected" column column in grid. the best will be the with type status. like this you can show user sonething like checkbox ;)

    on commit you have table with user selected rows :)