Test Data Manager

Expand all | Collapse all

Publish to CSV issue

Jump to Best Answer
  • 1.  Publish to CSV issue

    Posted 05-26-2020 10:45 AM
    Hi Team,

    I have registered a file and then configured the fields for data generation. When I publish the file in csv format, the published file has all values surrounded by double quotes. This is not accepted by the application where we import this file.

    I am getting the published file as below

    "A","B","C","D","E"

    but what we need is

    A,B,C,D,E --> without double quotes

    Please suggest what should be done. Do we need to cahnge some settings while importing the objects?

    Please help. Thanks in Advance

    Thanks,
    Aadhavan


  • 2.  RE: Publish to CSV issue

    Posted 05-27-2020 09:25 AM
    Hi Aadhavan,

    I'd suggest a post-publish action that strips the double-quotes from the file.

    Scott


  • 3.  RE: Publish to CSV issue

    Posted 05-27-2020 09:35 AM
    Hi Scott,

    Thanks,

    Post publish actions can be set for this? any example documentation available?
    I also faced one more issue in this. The published csv file has some non printable characters at the start of the file. Why TDM is generating non printable character?

    Thanks,
    Aadhavan



  • 4.  RE: Publish to CSV issue
    Best Answer

    Posted 05-28-2020 08:48 AM
    Hi Aadhavan,

    The Actions setup is documented here:
    http://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/devops/test-data-management/4-9/provisioning-test-data/generate-synthetic-test-data/generate-synthetic-data-using-datamaker/publish-data-using-datamaker/manage-publish-and-ad-hoc-actions.html

    The basic steps:
    (1) Enable HOST operations for your TDM Portal
    In the Portal application.properties, ensure the following is set to true (if you have to change it, restart the Portal afterwards)
    tdmweb.enableHostActions=true

    (2) For your Generator, click on the Create Publish Action button. 
    Name: StripDoubleQuotes
    Desc:   SDQ
    Action Type:  HOST
    Command:   <your path>\sdq.bat ~PUBJOBID~
    Execute Action:    Post

    (~PUBJOBID~ is an internally generated variable for the Publish Job number)

    (3)  Create the <your path>\sdq.bat file
    powershell -executionpolicy bypass -File .\sdq.ps1 %1
    (I'm using a Powershell script as an example as a quick search finds this reference to a one-liner to strip the double-quotes)
    https://devblogs.microsoft.com/scripting/remove-unwanted-quotation-marks-from-csv-files-by-using-powershell/

    I'll leave the details to you, the main thing to note is that the published file will be accessible at the location:
    C:\ProgramData\CA\CA Test Data Manager Portal\Jobs\Job_%1\
    (where %1 is the value passed into the .bat file by the ~PUBJOBID~ parameter)

    Also, I'm not seeing non-printable characters when I publish .csv files.   Can you check your original file that you registered to see whether it also had the characters?


  • 5.  RE: Publish to CSV issue

    Posted 05-29-2020 07:23 AM
    Thank you Scott, I will try this.