Sorting using reformat component in Abinitio

Can i sort the data using reformat component in Abinitio, If yes,Then how?

Showing Answers 1 - 5 of 5 Answers

Ravin R

  • Aug 19th, 2015
 

Yes. It is possible to sort data using reformat.
Try the below example.
Input file ----> Reformat -----> Output file
Input dml:
record
string("
") field;
end;
Input data:
8,1,4,2
Reformat:
let string("
") fieldsplit=string_split(in.field,",");
out.sort_field::string_join(vector_sort(fieldsplit),",");
Output dml:
record
string("
") sort_field;
end;

  Was this answer useful?  Yes

ravichcv85

  • Dec 29th, 2015
 

Hi Ravin - A small update to the above solution - in reformat we need to declare a length pre-fixed vector to get the above solution working.
let string("")[integer(2)] fieldsplit=string_split(in.field,",");

  Was this answer useful?  Yes

Mohankrishna

  • Mar 15th, 2016
 

There is a catch here...
The input data provided is a single record. And we are sorting the items of a single record.
The solutions is not applicable to the sorting requirement between multiple records

  Was this answer useful?  Yes

Archisma Ghosal

  • Sep 10th, 2016
 

Hi all,
I have found a problem with vector sort. Whenever we are trying to sort (17,16,5,89) it will give the value (16,17,5,89) whenever it is encountering 1 first it is ignoring 5. Can you help me with this?

  Was this answer useful?  Yes

Praveen

  • Sep 18th, 2016
 

You would have declared the it as string. Ex: string(|)[integer(2)]. That is why it is sorted as how string would be sorted. Declare it as decimal. Ex: decimal(|)[integer(2)]. It will sort in the right way

  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