Home » excel » c# – How to generate CSV file from WW object?

c# – How to generate CSV file from WW object?

Posted by: admin May 14, 2020 Leave a comment


I have represented some WW-objects in some Excel sheet and I need to create a CSV file that Wonderware accepts. That is, I need it in the “WW-format”shown here.

enter image description here

I am working with VSTO AddIns and everything should be done in C#. So are there some somewhat easy way to transform my WW object into the above shown or will I have to create everything manually?

How to&Answers:

Based on discussion in comments I can recommend this:

The file you shown in your post is most likely produced by ArchestrA -> Export -> Galaxy dump. I understand you want to programmatically create a file in such format (resembling galaxy dump csv) and then use it to perform Galaxy Load in ArchestrA. To understand the meaning of different columns in galaxy dump I suggest you start by reading these sections of the Application Server User Guide:
Application Server User Guide - TOC

This will give you overview, but won’t answer all questions, for example ConfigVarSecurityType is not even mentioned. Some of these columns are just “This is what it has to be” without the need to deeply understand. So what I’d recommend next, is to create a simple object in ArchestrA with few attributes of different types and different access settings. Then export that object to CSV, then change some attribute’s properties and export again to see what has changed in CSV. Then try to change things in CSV, load it into the Galaxy and check in ArchestrA if the changes are what you expected. Through this exercise you’d learn the structure of the CSV and then you’d be able to write the logic to create a file like this in C#.

An alternative approach is to use GRAccess toolkit and develop a software that directly communicates with the Galaxy repository to create and modify objects (i.e. you don’t need the galaxy load step). In my experience GRAccess is not intuitive at all, the documentation is not super clear but it’s rather complete. GRAccess approach gives you better control of importing/creating objects e.g. you can decide what to do when an object or tag already exists and you can interact with the user (e.g. ask skip/overwrite?) while importing.

If you Google “GRAccess Wonderware” you can find several examples how people use it to manipulate their galaxy objects programmatically.