Thought I posted earlier but can't see it in the thread(?)
Please see below for instructions
- If HOST action is not configured, please reference the documentation
here.
- If the default location for publishes has been changed in your implementation, update the Jobs path.
- Replace PERSONS.CSV with the appropriate .csv created by your Generator
- Update the location of the .bat and .ps1 files per your directory structure on the TDM Portal windows machine
---
Navigate to your Generator in TDM Portal
Click the Actions button
Click the Create Publish Action button
Action name: CSV-TO-PIPE
Action type: HOST
Set as type: Post
command:
C:\temp\tdmcmty\ruchi-to-pipe\csv-to-pipe.bat ~PUBJOBID~
The .bat file will look like:
powershell -executionpolicy bypass -File .\csv-to-pipe.ps1 %1
contents of Powershell script:
$jobid=$args[0]
echo "jobid : $jobid"
$fullpath="C:\ProgramData\CA\CA Test Data Manager Portal\Jobs\Job_" + $jobid + "\PERSONS.CSV"
echo "fullpath : $fullpath"
$reader = New-Object IO.StreamReader $fullpath
$writer = New-Object IO.StreamWriter 'C:\temp\tdmcmty\ruchi-to-pipe\pipe.txt'
while ($reader.Peek() -ge 0) {
$line = $reader.ReadLine().Replace(',', '|')
$writer.WriteLine($line)
}
$reader.Close(); $reader.Dispose()
$writer.Close(); $writer.Dispose()
Original Message:
Sent: 10-29-2021 05:53 AM
From: Ruchi Singh
Subject: Re: Publish to pipe delimited flat file is possible with CA TDM? If yes please help me with the steps? Appreciate your help.
Hi Anil,
Could you help me with the steps to add a post publish action to replace the delimiter from comma to pipe after publishing file to csv.
Thanks,
Ruchi
Original Message:
Sent: 09-13-2017 03:11 PM
From: Anil Kumar Appukuttan
Subject: Re: Publish to pipe delimited flat file is possible with CA TDM? If yes please help me with the steps? Appreciate your help.
Pratheesh,
You can publish to a csv and then maybe have a poist publish action to replace the delimiter from comma to pipe.
If you always require pipe as the delimiter, then you can change the system settings though control panel to set the "List Separator" as pipe instead of comma which is the default. This will get reflected in all applications as well. eg: if you save a csv from excel the separator will be pipe once you make this change.
Thanks,
Anil