hexagon logo

Export to CSV - putting DEVs in seperate COLUMNS

Hi there, I've worked through the code underneath. However I need my results in a different format:































Measurment # DEV Point 1 DEV Point 2 DEV Point 3
1 xxx xxx xxx
2 xxx xxx xxx
3 xxx xxx xxx
3 xxx xxx xxx


Is there any way I can achieve this? Currently all my DEVs are in one row with ";" in between.

Thanks a lot,

Erwin

How-To: Output selected data to a CSV file - PC-DMIS User Forum
http://www.pcdmisforum.com/showthread.php?15054-How-To-Output-selected-data-to-a-CSV-file

Post your code samples here<br> For all versions of PC-DMIS

Parents
  • So that thread has the writing in two/three-step process, which is kinda an extra step or two.
    He has us assigning data to variables and then concatenating those variables with commas into an "all" variable value.

    From that thread:
    ASSIGN/V1=C1.INPUT
    ASSIGN/VOD=OD_HOLE_POSITION.TP.DEV
    ASSIGN/VID=ID_HOLE_POSITION.TP.DEV
    ASSIGN/VRALL=V1+","+VOD+","+VID
    

    And then writing just that "all" variable value to the output file:
    FILE/WRITELINE,FPTR,VRALL
    





    More Efficient: You can skip the all variable assignments and just stick the data-grabbing expressions directly into the writing, like:
    FILE/WRITELINE,FPTR,C1.INPUT+","+OD_HOLE_POSITION.TP.DEV+","+ID_HOLE_POSITION.TP.DEV
    


    The key point is the commas: CSV stands for Comma Separated Values. When you import a CSV to Excel, those commas become columns.

    So Erwin, your writing code will be like:
    FILE/WRITELINE,FPTR,VariableOfMeasNumber+","+DimensionForPnt1.DEV+","+DimensionForPnt2.DEV+","+DimensionForPnt13DEV
    

    and the commas will separate the values into columns automatically.

    There is a catch, PC-DMIS has a 62-character line limit so sometimes you do have to use variables to concatenate chunks of stuff together as the quotes, plus signs, and commas add up real quick - and having long dimension names just makes it worse.
    I had to do one for some software that needed a single line of raw data for a big program. This meant that the code was writing the values of 12 variables to a single line output file - but each of those 12 was created by concatenating 20 variables together - each of which itself was created by concatenating between 5 and 15 dimensional results. It took me forever to code all that jazz and they used it twice.
Reply
  • So that thread has the writing in two/three-step process, which is kinda an extra step or two.
    He has us assigning data to variables and then concatenating those variables with commas into an "all" variable value.

    From that thread:
    ASSIGN/V1=C1.INPUT
    ASSIGN/VOD=OD_HOLE_POSITION.TP.DEV
    ASSIGN/VID=ID_HOLE_POSITION.TP.DEV
    ASSIGN/VRALL=V1+","+VOD+","+VID
    

    And then writing just that "all" variable value to the output file:
    FILE/WRITELINE,FPTR,VRALL
    





    More Efficient: You can skip the all variable assignments and just stick the data-grabbing expressions directly into the writing, like:
    FILE/WRITELINE,FPTR,C1.INPUT+","+OD_HOLE_POSITION.TP.DEV+","+ID_HOLE_POSITION.TP.DEV
    


    The key point is the commas: CSV stands for Comma Separated Values. When you import a CSV to Excel, those commas become columns.

    So Erwin, your writing code will be like:
    FILE/WRITELINE,FPTR,VariableOfMeasNumber+","+DimensionForPnt1.DEV+","+DimensionForPnt2.DEV+","+DimensionForPnt13DEV
    

    and the commas will separate the values into columns automatically.

    There is a catch, PC-DMIS has a 62-character line limit so sometimes you do have to use variables to concatenate chunks of stuff together as the quotes, plus signs, and commas add up real quick - and having long dimension names just makes it worse.
    I had to do one for some software that needed a single line of raw data for a big program. This meant that the code was writing the values of 12 variables to a single line output file - but each of those 12 was created by concatenating 20 variables together - each of which itself was created by concatenating between 5 and 15 dimensional results. It took me forever to code all that jazz and they used it twice.
Children
No Data