Record to Column

I have a record like below:
avi,mahi,virat,mahi,avi,virat,mahi,virat,avi
Output should be:
avi1
mahi1
virat1
mahi2
avi2
virat3
mahi3
virat4
avi3
Please suggest how can I achieve this.

Showing Answers 1 - 5 of 5 Answers

Sonali U

  • Mar 15th, 2018
 

Use scan component. Use player name as key. In scan transformation use count function on player name.

  Was this answer useful?  Yes

Alok

  • Mar 22nd, 2018
 

You can achieve this using Normalize. In the length function, check the length (by converting it into a vector/using string_length(string_filter_out(,","))+).
Then in normalize use you can use "string_split(,",")[index]" to get the each value in the output.

  Was this answer useful?  Yes

crazypanda123

  • Mar 23rd, 2018
 

you can use scan with sorted-input False and maintain-order True

  Was this answer useful?  Yes

Sandeep

  • Mar 25th, 2018
 

Use scan component using check sort attribute as false(maintain order-false)
then use name as key and for sequence number use count(in.name)

  Was this answer useful?  Yes

neha.nagare

  • Apr 26th, 2018
 

Flow I/p ->normalize ->scan->o/p
We can achieve this by using normalize and scan component ,make vector by using string_split function and assign size of the vector to the length function of the normalize component and assign each index of the vector to the normalize, In scan keep the sorted input false and use string_concat function with name_column and count of name_column in the final assignment .
please find below code :
NORMALIZE :-
let string("")[] list =allocate_with_defaults(); //global vector variable
out::length(in)=
begin
list=string_split(in.name,",");
out.length::length_of(list);
end
out::normalize(in,index)=
begin
out.name::list[index];
end
SCAN :-
out::scan(in)=
begin
out.name::string_concat(in.name,(string(""))(decimal(""))count(in.name));
end

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions