- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2016 07:59 PM
i want to transform (source.description) data which is in this format:
1. Click Website, 2. Enter Login Information, 3. Click Login, ...."
Into an HTML field (target.u_description) in this format:
1. Click Website,
2. Enter Login Information,
3. Click Login"
I tried this in a "Script Background" as follows and it works, I am not sure how to use it in a transform map:
var str = " 1. Click Website, 2. Enter Login Information, 3. Click Login";
var na = str.split(",");
for (var i = 0; i < na.length; i++) {
gs.print(na[i]);
}
Help appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2016 09:33 AM
Hi Minaz,
You might want to try using a script for the source on your transform entry with something like this.
answer = (function transformEntry(source) {
// Add your code here
return source.description.split(",").join("\n"); // return the value to be put into the target field
})(source);
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2016 09:33 AM
Hi Minaz,
You might want to try using a script for the source on your transform entry with something like this.
answer = (function transformEntry(source) {
// Add your code here
return source.description.split(",").join("\n"); // return the value to be put into the target field
})(source);
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2016 06:19 AM
Hello Jose, thanks for your help.
Although the transform was successful, the data did not split and did not put it in separate lines.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2016 02:30 PM
Hi Minaz,
I missed that you were updating an html field. You will want to replace "\n" with "<br>" for an html new line.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2016 10:42 AM
Thank you Jose. That worked. However, another issue has cropped up.
When I am trying to transform:
1. some text 1, 2. some text 2, 3. some text 3, 4. some.........
the HTML or the String field, although get updated with the split data in new lines but the data cuts of at 3. s
1. some text 1,
2. some text 2,
3. s
This also happens even if I am not using any field map script.
Any idea why?