PDI: how to handle many rows as a single xml value - soap

I have to handle these steps:
- order (table input)
- id
- order row (table input)
- order_id
- row_id
- product_id
- quantity
- a soap web service to call
I have to execute the soap web service for every order passing all the order's rows for the given order.
For example, if I have 3 orders I must execute the web service 3 times and at every execution I must pass to the soap web service all the order's rows as xml argument like this:
<rows>
<item>
<order_id>1</order_id>
<row_id>1</row_id>
<product_id>123</product_id>
<quantity>12</quantity>
</item>
<item>
<order_id>1</order_id>
<row_id>2</row_id>
<product_id>456</product_id>
<quantity>65</quantity>
</item>
... and so on...
</rows>
I cannot figure out how to design the trasformation so it can executes the soap web service for each single order passing all the order's rows as xml single value.
Any help ? (many thanks in advance...)

It looks like u need to look on examples which are distributed with data-integration package.
Look into $KETTLE_HOME/sample/transformations/transformation-executor
2 helpful steps are "Get rows from result" and "Copy rows to result" will let u manage your needs.

Same.
Look inside of example directory and find "XML Join - Create a multilayer XML file".
But there are another ways to solve problem. U can just dump all fragments to xml file and then load file again in next transformation.

Related

Get Outreach Activity data from ORN via SOAP calls

I use Oracle RightNow via SOAP API.
Using QueryCSV option, I can get a lot of information (E.g.: about an incident SELECT * FROM Incident WHERE ...), but I don't know how to get information about Outreach Activity.
I saw on the RightNow forum that I could get this kind of information from ma_trans table, but I don't know how to select data from this table.
Outreach Activity tab that should show data from the ma_trans table
I tried different approaches, but I always get responses like this:
Request:
SELECT * FROM ma_trans
Response:
...
<n0:RequestErrorFault xmlns:n0="urn:faults.ws.rightnow.com/v1_3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<n0:exceptionCode>INVALID_REQUEST</n0:exceptionCode>
<n0:exceptionMessage>no such table: ma_trans</n0:exceptionMessage>
</n0:RequestErrorFault>
...
or
Request:
SELECT Contact.ma_trans FROM Contact
Response:
...
<n0:RequestErrorFault xmlns:n0="urn:faults.ws.rightnow.com/v1_3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<n0:exceptionCode>INVALID_REQUEST</n0:exceptionCode>
<n0:exceptionMessage>Non-existent column: 'ma_trans'</n0:exceptionMessage>
</n0:RequestErrorFault>
...
How can I get information about Outreach Activity and how can I get data from this ma_trans table?
The ma_trans table is not exposed through the Connect Object Model or ROQL. transactions is exposed through ROQL, as well as some of the other "managed tables", which you can view in any of the documentation for services that expose connect APIs (i.e. the PHP, SOAP, REST, etc. APIs).
You could get this data by creating a report to query for the data that you need, and then use the runAnalyticsReport method to get data from the report. But, since ma_trans can contain a lot of data, be sure that your report is filtered properly as to not extend beyond run time or data threshold limits.

Grouping of Data in UI5 XML Table

I have a xml table listing Product ID and the status from the odata consumed. I have grouped the data(PFA) based on the concept of sorting and filtering.
I want to further group the Product ID with repetitive occurrence in the xml table and show the count of the grouped products.
Note: In my table I have a product called "Power Wheel Chair" with three occurrence. I want to group it as display only one power wheel chair with the count as 3 in another field.
Please provide your suggestions on how to accomplish this. Also do revert back for further queries.Grouping table
Regards,
Srinivasan
It would be best to have the server to handle aggregation of lines items into totals and have it to return the condensed set in a separate EntitySet (e.g. ProductCounts), that would look something like this:
[
{ product: A, count: 5 },
{ product: B, count: 7 }
]
Doing this on the server, has the benefit that a much smaller set of data is downloaded to the client. In the earlier example 12 records would have been downloaded instead of two. On top of that, the client doensn't need to do the processing and math, but this is delegated to the server. And that's great, because the server usually has the means to crunch large amounts of data efficiently.
If you still want to do the calculation client side, I would suggest writing a little code in the success handler of the ODataModel.read method that does the aggregation and pushes the result into a JSON model. You can then bind the JSON model to your table control.

Openrefine: cross cluster two dataset

I've got two datasets with titles and other informations, but in dataset A I have titles, in dataset B I have titles and URL.
I have to put the URL in dataset A from dataset B. Some titles are the same in A and B, some others are not, some others are slightly different (and here comes the problem).
So I need to merge and cluster at the same time those who are similar. I know that I can reconcile with DBpedia, but what I need is to "reconcile" between the two dataset.
Is it possible in some way?
Thank you.
You can use reconcile-csv application (it's not plugin for OpenRefine, but standalone program that runs local reconciliation API server).
Export dataset B as csv with first row as column names, then start reconcile-csv, using URL as id column and name as search column:
java -Xmx2g -jar reconcile-csv-0.1.2.jar <CSV-File> <Search Column> <ID Column>
Then open dataset A and add http://localhost:8000/reconcile as reconciliation service. After reconciliation, cell.recon.match.id for each reconciled cell will contain URL.

CakePHP Master/Detail Form - simple Issue

I'm building a simple master/detail edit form using Cake, but can't get the values from the details records to populate the form.
Workorder -> Master
WorkorderIssues -> Detail
DebugKit tells me the data is being returned properly from both the master and detail tables.
I can populate the form with master data just fine using:
Form->input('workorder_ref');?>
..but the same approach doesn't work for the detail data:
Form->input('WorkorderIssues.issue_owner');?>
Post data:
Workorder(array)
workorder_id 1
workorder_ref 9212
WorkorderIssues(array)
0(array)
issue_id 1
issue_workorder_id 1
issue_owner shaun
I would appreciate some help..it's probably something simple I'm overlooking.
Many Thanks,
Shaun
The context of the question was an edit form for master/detail records with a hasMany association from Workorder to WorkorderIssue.
Master data from the request can be accessed as usual like:
form->input('fieldname'); There is only one record.
In my example, the master data (Workorder) is accessed as:
form->input('workorder_num');
Multiple records from the Associated/detail data can be accessed from the request as:
form->input('workorderissue.0.issue_description');
form->input('workorderissue.0.issue_owner');
form->input('workorderissue.1.issue_description');
form->input('workorderissue.1.issue_owner');
form->input('workorderissue.2.issue_description');
form->input('workorderissue.2.issue_owner');
...the integer index (0,1,2) represents the array element each record is stored under.

How to build a conditional branch in Talend if no row was updated in a tMysqlRow?

In my Talend job I have some xml files. Each of these files contains a field that I will use in the WHERE clause of an UPDATE statement.
I will not describe the whole job and how I've done it, but only the small excerpt: I've modeled this by using a tFileInputXML and a tMysqlRow component.
In the tMysqlRow component I've built an UPDATE query like the following (simplified) one:
"UPDATE `my_table`
SET `my_table`.`oneField` = '" + row1.ONEFIELD + "'
WHERE `my_table`.`id` = '" + row1.ID
This works fine for me. But I don't understand how to model the exceptionnel case if there will be no updated rows, because the ID wasn't be found in the table. I know that there is a trigger "run if", but I don't how to use it exactly.
Can anybody help?
I think you should use a preceding component (tMap) that will filter the content of your XML files by defining a join between the ID column of your table and the ID column in your XML.
Because your main flow (row1) comes from the XML files, you have to reject the rows where the IDs won't be found in the database. That's (one of) the role of tMap component.
You can also have a look on the tJoin component but I haven't used it till now.