# Struggling With More Complex Operations

**URL:** <https://forum.cloverdx.com/t/struggling-with-more-complex-operations/1088>\
**Category:** CloverDX Platform\
**Created:** [July 4, 2012, 12:00am UTC](https://forum.cloverdx.com/t/struggling-with-more-complex-operations/1088 "2012-07-04T00:00:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![phaynes](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@phaynes](https://forum.cloverdx.com/u/phaynes)\
**Post date:** [July 4, 2012, 12:00am UTC](https://forum.cloverdx.com/t/struggling-with-more-complex-operations/1088/1 "2012-07-04T00:00:00Z")

</div>

Hi,

I’m new to ETL and am evaluating a bunch of different tools to see what fits our needs. I have made some good progress but have now run into a bit of a roadblock and need help 🙂

One of the things I’m trying to do is modify a mySQL file from Wordpress, but so far I’m running into some issues.

I have the file loaded in via DBInputTable. The data in the table looks as follows:

meta\_id post\_id meta\_key meta\_value

53 21 \_wp\_page\_template tpl-myaccount.php  
54 22 \_wp\_page\_template tpl-articles.php  
55 23 \_wp\_page\_template tpl-contact.php  
56 24 \_wp\_page\_template tpl-checkout.php  
57 25 \_wp\_page\_template tpl-callback.php  
58 26 type article  
59 26 image article.jpg  
60 27 type article  
61 27 image article.jpg  
64 28 SKU 001  
65 28 hits 102  
66 28 price 30  
67 28 old\_price 49.99  
68 28 image [http://ecx.images-amazon.com/images/I/41PbLTMtFgL.jpg](http://ecx.images-amazon.com/images/I/41PbLTMtFgL.jpg%C2%A0)  
69 28 images [http://ecx.images-amazon.com/images/I/41PbLTMtFgL.jpg,http://ecx.images-amazon.com/images/I/41258sEWRLL.jpg,](http://ecx.images-amazon.com/images/I/41PbLTMtFgL.jpg,http://ecx.images-amazon.com/images/I/41258sEWRLL.jpg,%C2%A0)  
70 28 customlist1  
71 28 customlist2  
72 28 customlist3  
73 28 customlist6  
74 28 qty 50  
75 28 featured yes

What I want to do is create the following output for the data highlighted in blue:

post\_id SKU hits price old\_price image  
28 001 102 30 49.99 [http://ecx.images-amazon.com/images/I/41PbLTMtFgL.jpg](http://ecx.images-amazon.com/images/I/41PbLTMtFgL.jpg%C2%A0)

alt\_image1  
[http://ecx.images-amazon.com/images/I/41PbLTMtFgL.jpg](http://ecx.images-amazon.com/images/I/41PbLTMtFgL.jpg)

alt\_image2  
[http://ecx.images-amazon.com/images/I/41258sEWRLL.jpg](http://ecx.images-amazon.com/images/I/41258sEWRLL.jpg)

qty featured  
50 yes

Is there any documentation that specifically deals with how to do this type of manipulation?

Totally stuck…

Thanks … Peter

---

<div class="post-metadata">

**Author:** ![David\_Hlidek](https://avatars.discourse-cdn.com/v4/letter/d/58f4c7/32.png) [@David\_Hlidek](https://forum.cloverdx.com/u/David_Hlidek)\
**Post date:** [July 4, 2012, 1:12pm UTC](https://forum.cloverdx.com/t/struggling-with-more-complex-operations/1088/2 "2012-07-04T13:12:54Z")

</div>

Hi Peter,

there is useful component for what you need - [http://doc.cloveretl.com/documentation/ … pivot.html](http://doc.cloveretl.com/documentation/UserGuide/index.jsp?topic=/com.cloveretl.gui.docs/docs/pivot.html)

\* define input (meta\_id, post\_id, meta\_key, meta\_value) and output (post\_id, SKU, hits, price, old\_price, image, …) metadata  
\* read records in input metadata format  
\* sort them via post\_id  
\* input them into pivot component  
\* output of pivot component is in output metadata format

Set pivot properties to:  
\* key = post\_id  
\* Field defining output field name = meta\_key  
\* Field defining output field value = meta\_value

Keep in mind values in meta\_key must exactly correspond to filed names in output metadata.

I hope this helps.

---

<div class="post-metadata">

**Author:** ![phaynes](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@phaynes](https://forum.cloverdx.com/u/phaynes)\
**Post date:** [July 4, 2012, 6:59pm UTC](https://forum.cloverdx.com/t/struggling-with-more-complex-operations/1088/3 "2012-07-04T18:59:14Z")

</div>

Thank you for your prompt response … I got it to work once I figured out that I had to add all the meta\_key values to the output metadata 🙂

Only one small problem, the post\_id was not populated on the output file. How can I achieve this as I will need it for later processing?

Thanks … Peter

---

<div class="post-metadata">

**Author:** ![phaynes](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@phaynes](https://forum.cloverdx.com/u/phaynes)\
**Post date:** [July 5, 2012, 7:06pm UTC](https://forum.cloverdx.com/t/struggling-with-more-complex-operations/1088/4 "2012-07-05T19:06:33Z")

</div>

Hi,

Please ignore my last question, I’ve figured it out.

I set a different type (string) for post\_id in the output metadata from the type (long) set in the input metadata.

Thanks … Peter

---

<div class="post-metadata">

**Author:** ![phaynes](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@phaynes](https://forum.cloverdx.com/u/phaynes)\
**Post date:** [July 7, 2012, 7:17pm UTC](https://forum.cloverdx.com/t/struggling-with-more-complex-operations/1088/5 "2012-07-07T19:17:30Z")

</div>

Hi,

Can you help me please.

I get the following data in the description field of my input file, and would like to use Cloveretl to strip out the html tags colored blue leaving the actual text and remove all of the html code colored green

Vitamin A as Beta Carotene is a vision-enhancing nutrient was isolated in 1930, the first fat-soluble vitamin to be discovered. The body acquires some of its vitamin A through animal fats or vegetable sources.

- Vitamin A is required for night vision, and for a healthy skin.
- It boosts the immune system, builds resistance to infections
- keeps tissue in good health.

Vitamin A and B2 work together to help keep mucous membranes in the gastrointestinal tract healthy.\*These statements have not been evaluated by the Food and Drug Administration. This product is not intended to diagnose, treat, cure or prevent any disease.
* * *
 ![New You Vitamins Amazon.com]( "New You Vitamins Amazon.com")
* * *

Please note that I have other fields in my input file that contain html that I need to keep.

I have searched the forum and documentation and can find nothing obvious on this particular topic.

Is what I want to do possible in Cloveretl and, if so, how can I achieve it?

Many thanks … Peter

---

<div class="post-metadata">

**Author:** ![David\_Hlidek](https://avatars.discourse-cdn.com/v4/letter/d/58f4c7/32.png) [@David\_Hlidek](https://forum.cloverdx.com/u/David_Hlidek)\
**Post date:** [July 9, 2012, 9:00am UTC](https://forum.cloverdx.com/t/struggling-with-more-complex-operations/1088/6 "2012-07-09T09:00:16Z")

</div>

Hi Peter,

you can either use [http://doc.cloveretl.com/documentation/ … eader.html](http://doc.cloveretl.com/documentation/UserGuide/index.jsp?topic=/com.cloveretl.gui.docs/docs/xmlreader.html) if your file is valid xml, or use function “replace” in Reformat component. See [http://doc.cloveretl.com/documentation/ … -ctl2.html](http://doc.cloveretl.com/documentation/UserGuide/index.jsp?topic=/com.cloveretl.gui.docs/docs/string-functions-ctl2.html) It supports regular expression so maybe it will be usable for you.
