Inserted data from selected rows into a db table...

Hi all,

I have a view that displays data via a web services from various tables of my local database. I am able to select rows using checkboxes and display these selected rows an async table within the same view.

What I actually need to do is insert some of the fields of the selected rows into another table in my local database.

I have a content provider from an insert web service (test manually and able to insert a list of rows) and an action that assigns to the input parameters of the the content provider - the output results of my selected rows - but I’m getting various errors.

Can someone please help…

I’ve actually resorted to a simple test case that gets all rows from a table “products” and inserts selected rows from a view into a new table products1…

See attached - “testCase” (the design) and “Results” - results of testCase…

Thank you very much.
Vikash


Would it be possible to create a standalone example of this use case using just in memory data structures?

Hi Mimel,

Thank you for your response.

Regarding your question - Would it be possible to create a standalone example of this use case using just in memory data structures?

  • I am not sure - can you please give me some directions on how to go about this…

Thanks
Vikash

The challenge is that i can’t really understand what you are trying to accomplish with just screenshots. Or at least, i don’t really understand the detailed approach you are attempting.

The most effective way to communicate this information so that i can make any suggestions is to provide a simple standalone sample application that demonstrates the scenario and the problem.

Most of the time, the applications that people need to develop have a variety of functionality outside of the question that they are asking, so a simple demonstration app can skip the extra functionality. Additionally, most applications pull data from external systems (Web Services or databases for example). To provide a simple standalone app, you would hard code some sample data in a simple data structure and use that data to populate the simple application.

If you can provide this simple app, then I’ll have a much better chance in providing guidance to help you with your current challenge.

Regards,
–mark

Hi Mark,

This test case is simply a proof of concept of my real problem which is :-
I am building a portal to view (V), print(P) or reprint (R) purchase orders (PO) for all vendors of our organisation. The services and portal is almost completely designed and I am now at a point of selecting rows of displayed PO’s to do one of V,P or R.

Some background :-

  1. I have only about two Months of webMethods experience - CAF -only just started :roll:
  2. Data is extracted from numerous tables in our SAP database and stored in our local webMethods Oracle database.
  3. I have adapter, flow, web services that extracts data that’s required to be displayed.
  4. I have a batch insert adapter service with it’s web service for inserting selected records into a history table in my Oracle database.
  5. I am able to select rows and simply display these in an async table on the same view but when I attempt to use an action that inserts into my history table - I fail - I tried everything I know possible.

So the test case described in my initial post was simply to prove the concept of inserting selected rows into a database table.

I thought that a good route to go would be recreating the current situation and therefore attached all the design through the bindings view.

Hope this makes things clear…

Mark, once again thanks for the replies - I appreciate your input. Tried posting this in other forums and no one replies - tried to explain in various ways but still no response.

Please let me know if you need any other information.

Kind regards.
Vikash

Here is a tutorial that shows how to deal with selected information from a table: http://communities.softwareag.com/ecosystem/communities/public/Developer/webmethods/tutorials/CAF/TableRowSelection/WorkingWithTableRowData_index.html

I’m thinking that this tutorial shows how you can have programmatic access to the new rows. Then, you can feed that data into the inputs of your web service.

I hope this helps.
–mark

PS: Here’s a tutorial that shows how to manipulate rows in a table: http://communities.softwareag.com/ecosystem/communities/public/Developer/webmethods/tutorials/CAF/TableRowControls/TableRowControls_index.html

Hi Mark,

Thank you for these tuts - I got my test case working using the first tutorial - WorkingWithTableRowData_index.html (see results attachment on my initial post) - but my scenario is taking this just one step further and that’s instead of displaying the selected rows - I need to insert these into a database table.

I have all the pre-requisites (testcase attachment on my initial post) - but I cannot get the implementation of my assignments working on an action to insert the selected rows into my db table.

Do you know -

  1. if a web service using a batch insert adapter service works?
  2. if there may be any bugs/fixes regarding action implementations?

Thanks again for your assistance.
Kind regards
Vikash

I’m not sure i understand. I think the first tutorial gives you Server Side access to the selected data (new rows in your case). Can you confirm?

Are you then able to pass that data to your custom web services? Can you confirm?

Hi Mark,

Basically,

  1. My web service “flwGetProducts” gets the products data from the products
    table in my database (using a flow service Get Products via it’s JDBC select
    adapter service)

  2. I create a content provider “productsOutProvider” to display the above results
    on my view. (Here I insert the select row checkbox - leaving me a point 6d of
    your tutorial 1)

  3. I then follow point 7 thru to 11 to achieve my attached “results” in my initial
    post.
    3.1. My page bean property name = selectedProducts
    3.2. Code for getter method - getSelectedProducts is :

    public ArrayList getSelectedProducts() {
    if (selectedProducts == null) {
    selectedProducts = new ArrayList();
    }
    resolveDataBinding(SELECTEDPRODUCTS_PROPERTY_BINDINGS,
    selectedProducts, “selectedProducts”, false, false);
    return selectedProducts;
    }

    3.3. My code on my go() action that displays selected rows is :

        public String go() {
    

    selectedProducts = new ArrayList();
    List selectedRows =
    this.getProductsOutProvider().getSelectedRows();
    if (selectedRows != null && selectedRows.size() != 0) {
    for (Iterator iterator =
    selectedRows.iterator(); iterator.hasNext(); ) {
    productsOut2 p = (productsOut2) iterator.next();
    selectedProducts.add(p);
    }
    }
    return OUTCOME_OK;
    }

Now, what I need to do is instead of displaying these selected rows - I want to insert them into another table “products2” in the same database that I am retrieving the initial products data…

So I have -

  1. An batch JDBC insert adapter service to insert into Products1 table
  2. A flow service - using this JDBC from which I create my web service
    “flwBInsertProducts1” (flow Batch Insert into Products1)

My question is how do I pipe my selected rows into this web service flwBInsertProducts1?

I attempted this by creating an action goin() and in my data flow implementation I assigned the selectProducts list fields to my input parameters of my flwBInsertProducts1 webservice.

It’s just this last bit that I’m stuck with - for weeks - pls help :cry: It just can’t be too difficult from here and that’s why I asked -
Do you know -

  1. if a web service using a batch insert adapter service works?
  2. if there may be any bugs/fixes regarding action implementations?

Hope this makes things more clearer…
Thanks
V

That sounds like you are doing the correct thing. Did you call refresh() on your webservice after doing the assignment to the input parameters?

If this isn’t working properly, you’ll need to isolate where it is failing. For instance, you should debug your method go() to ensure that you are actually getting a populated list. If so, you’ll want to use the SOAP monitor to see if the out going WS request is sending the data. If so, you’ll want to debug/Trace on the IS Service side to see if you are getting the input data.

  1. CAF WS clients should be able to invoke any type of web service regardless what the implementation of that service is. If you are specifically asking about Adapter Services, you might want to post a question to the Integration ESB forum.

  2. None that I’m aware of.

Regards,
–mark