I have been trying to remove .dat from ${originalFilename} in destination when i tried to do this ${originalFilename}.txt it gave me like 1652807798759.dat.txt how can i get 1652807798759.txt only without .dat in it
I have tried to do this in Destination’s Transformer but no luck
JavaScript
x
6
1
channelMap.put('OrigFilename', sourceMap.get('originalFilename'));
2
3
var outFile = channelMap.get('OrigFilename');
4
logger.info('outFile ' + outFile ); // i am getting outFile as null here
5
//outFile=outFile.replace('.dat','');
6
Advertisement
Answer
A simple replace should work:
JavaScript
1
5
1
//test it with a static string first, in real code use sourceMap.get('originalFilename').toString();
2
var outFile = '1652807798759.dat.txt' ;
3
outFile = outFile.replace(/.dat/g, "");
4
logger.info('outFile ' + outFile );
5