cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to remove blank rows from an input flat file?

darshthakkar
Valued Contributor

Hi Team,

How can I remove all the blank rows from an input flat file? I cannot use a condition restricted on a single column as the other records are needed. All I want to do is filter out ALL ROWS that doesnโ€™t have any data (like Row 4, 5, 7, 8 shown in the screenshot below)

image

Desired Output:
image

Thus, final output should be:
image

Thanking in advance.

Regards,
DT

1 ACCEPTED SOLUTION

ddellsperger
Employee
Employee

This is maybe a little bit difficult, but you can put the following filter after your parser
The expression is: $.entries().filter(v => v[1] != "").length > 0 which will find any instance where all of the values for the given input document are all empty and filter them out.
image

View solution in original post

18 REPLIES 18

AleksandarAngel
Contributor III

Hi @darshthakkar,

After parsing the file try using a filter with the following expression $ != {}.

Let me know if this helps,

BR,
Aleksandar.

Sure @AleksandarAngelevski , I will give it a try,
I tried with isEmpty() both on filter and router but it didnโ€™t work, was planning to put a condition on all the columns as the last resort (but that is not a good design to be honest).

This is not fetching the desired results.

ddellsperger
Employee
Employee

This is maybe a little bit difficult, but you can put the following filter after your parser
The expression is: $.entries().filter(v => v[1] != "").length > 0 which will find any instance where all of the values for the given input document are all empty and filter them out.
image