on 2011 May 18 7:44 PM
Hi All
I have a requirement wherein I have to sort a CSV based on a couple of columns. I believe this can be achieved by OS commandline argument. What exactly would be the code for the same that needs to be fed in the source file adapter?
And can we use perl script here?
Regards
Soumen Das
Request clarification before answering.
why dont you sort the file in the Mapping defining a DT according to result structure?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK lemme be a bit clearer...Following is my structure...Source and target same...
Node(0...n)
----Field1
----Field2
----Field3
----Field4
----Field5
Now I need to sort based on Field2 and Field4 lets say. Target should have the rows re-arranged according to the sort result. How do we do it using Graphical mapping?
There are few ways to achieve this. If your Field2 is the field decides then
First sort field2 .. since it value can occur in the multiple context.. bcuz o to many
step 1
field2 --> remove context --> sort --> split by value (context change) ---> field2
step 2
sort field1 based on field2
field2 --> remove context ---> 1
field1--->remove context ---> 2
inputs 1 and 2 ---> sortbykey --> SplitByValue(each value) -->field1
Like that we can do for other fields like field3, field4 etc repeating second step for every field
@Bhaskar : You logic holds true if the mentioned field 2 is different in every context. But my requirement is if Field2 is similar in two contexts Field1 values need to be sorted which aint happening if I apply this. Any idea how to achieve this?
@Ravi : Concatenation wont work because the fields aren't fixed length.
@Bhaskar : You logic holds true if the mentioned field 2 is different in every context. But my requirement is if Field2 is similar in two contexts Field1 values need to be sorted which aint happening if I apply this. Any idea how to achieve this?
@Ravi : Concatenation wont work because the fields aren't fixed length.
User | Count |
---|---|
81 | |
30 | |
10 | |
8 | |
8 | |
7 | |
6 | |
6 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.