12-27-2023 11:12 PM
I am reading one text file in snaplogic and have to skip unnecessary lines after every 4th line.
Solved! Go to Solution.
12-28-2023 05:56 AM - edited 12-28-2023 11:52 AM
Hello,
You can group into an array and then:
$myArray.filter((item, pos, a) => (a.indexOf(item)+1)%4 != 0)
% is the MOD function.
Hope it helps!
12-28-2023 05:56 AM - edited 12-28-2023 11:52 AM
Hello,
You can group into an array and then:
$myArray.filter((item, pos, a) => (a.indexOf(item)+1)%4 != 0)
% is the MOD function.
Hope it helps!
01-04-2024 04:44 AM
@salonimaggo - While the solution provided by @nativeBasic functionally works, I am concerned with the memory requirements when processing large files. I recommend a slightly different approach using one of SnapLogic's built-in properties, specifically, the snap.in.totalCount property. You can accomplish the same result using a Filter snap and allow your pipeline to work with the streaming data, rather than collecting the entire input file into memory.
Hope this helps!