Wonderware System Platform create Excel file from template

Apollas

Member
Join Date
Nov 2013
Location
city
Posts
22
Hello and Happy New Year Everyone,

I'd like to create an Excel file from a template via a script in Galaxy IDE. Maybe somebody has a simple example of a script how to do it?
Thanks in advane.

Regards,
Giedrius K.
 
I believe you will have to build a *.csv file using "FileWriteMessage" commands. This type of file can be easily opened in Excel.
Here is an example of a csv file script I use...
It is based on what parameters the customer selects to get written.
You can see from the "FileWriteMessage" command that I can give the command a line feed, to go to the next line, or continue writing on the same line.
___________________________________________________________________
IF V19-OnDly4FileWrite == 1 THEN

V19-RunData01 = $TimeString;
V19-RunData02 = Text(V19-ChamberMicronsPrimary, "0.0" );
V19-RunData03 = V19-ChamberHighVac.Comment;
V19-RunData04 = Text(V19-ChamberPSIA, "00.0" );
V19-RunData05 = Text(V19-Setpoint, "0000.0" );
V19-RunData06 = Text(V19-ControlTC, "0000.0" );
V19-RunData07 = Text(V19-WTc01, "0000.0" );
V19-RunData08 = Text(V19-WTc02, "0000.0" );
V19-RunData09 = Text(V19-WTc03, "0000.0" );
V19-RunData10 = Text(V19-WTc04, "0000.0" );
V19-RunData11 = Text(V19-WTc05, "0000.0" );
V19-RunData12 = Text(V19-WTc06, "0000.0" );
V19-RunData13 = Text(V19-WTc07, "0000.0" );
V19-RunData14 = Text(V19-WTc08, "0000.0" );
V19-RunData15 = Text(V19-WTc09, "0000.0" );
V19-RunData16 = Text(V19-WTc10, "0000.0" );
V19-RunData17 = Text(V19-WTc11, "0000.0" );
V19-RunData18 = Text(V19-WTc12, "0000.0" );


V19-Runs_NextLine01 = V19-RunData01;

IF V19-Log_Torr == 1 THEN
V19-Runs_NextLine01 = V19-Runs_NextLine01 + "," + V19-RunData02;
ENDIF;

IF V19-Log_Microns == 1 THEN
V19-Runs_NextLine01 = V19-Runs_NextLine01 + "," + V19-RunData03;
ENDIF;

IF V19-Log_PSIG == 1 THEN
V19-Runs_NextLine01 = V19-Runs_NextLine01 + "," + V19-RunData04;
ENDIF;

IF V19-Log_SP == 1 THEN
V19-Runs_NextLine01 = V19-Runs_NextLine01 + "," + V19-RunData05;
ENDIF;

IF V19-Log_Control == 1 THEN
V19-Runs_NextLine01 = V19-Runs_NextLine01 + "," + V19-RunData06;
ENDIF;

IF V19-Log_WkTc01 == 1 THEN
V19-Runs_NextLine01 = V19-Runs_NextLine01 + "," + V19-RunData07;
ENDIF;

IF V19-Log_WkTc02 == 1 THEN
V19-Runs_NextLine01 = V19-Runs_NextLine01 + "," + V19-RunData08;
ENDIF;

IF V19-Log_WkTc03 == 1 THEN
V19-Runs_NextLine01 = V19-Runs_NextLine01 + "," + V19-RunData09;
ENDIF;

V19-Runs_NextLine02 = " ";

IF V19-Log_WkTc04 == 1 THEN
V19-Runs_NextLine02 = V19-Runs_NextLine02 + "," + V19-RunData10;
ENDIF;

IF V19-Log_WkTc05 == 1 THEN
V19-Runs_NextLine02 = V19-Runs_NextLine02 + "," + V19-RunData11;
ENDIF;

IF V19-Log_WkTc06 == 1 THEN
V19-Runs_NextLine02 = V19-Runs_NextLine02 + "," + V19-RunData12;
ENDIF;

IF V19-Log_WkTc07 == 1 THEN
V19-Runs_NextLine02 = V19-Runs_NextLine02 + "," + V19-RunData13;
ENDIF;

IF V19-Log_WkTc08 == 1 THEN
V19-Runs_NextLine02 = V19-Runs_NextLine02 + "," + V19-RunData14;
ENDIF;

IF V19-Log_WkTc09 == 1 THEN
V19-Runs_NextLine02 = V19-Runs_NextLine02 + "," + V19-RunData15;
ENDIF;

IF V19-Log_WkTc10 == 1 THEN
V19-Runs_NextLine02 = V19-Runs_NextLine02 + "," + V19-RunData16;
ENDIF;

V19-Runs_NextLine03 = " ";

IF V19-Log_WkTc11 == 1 THEN
V19-Runs_NextLine03 = V19-Runs_NextLine03 + "," + V19-RunData17;
ENDIF;

IF V19-Log_WkTc12 == 1 THEN
V19-Runs_NextLine03 = V19-Runs_NextLine03 + "," + V19-RunData18;
ENDIF;
ENDIF;


FileWriteMessage( V19-PathRuns + V19-LoadedRunNoText + "RD" + ".csv", -1,
V19-Runs_NextLine01, 0);

FileWriteMessage( V19-PathRuns + V19-LoadedRunNoText + "RD" + ".csv", -1,
V19-Runs_NextLine02, 0);

FileWriteMessage( V19-PathRuns + V19-LoadedRunNoText + "RD" + ".csv", -1,
V19-Runs_NextLine03 ,1 );
______________________________________________________________________
 
Last edited:
Originally, I was creating a *.csv file, but there are couple of disadvantages, so I decided to switch directly to an Excel file. When I generate a *.csv file it's saved in UTF-8 encoding and then text is not displayed properly when it's opened in Excel. I think it's possible to solve this problem with languages settings, but still it's not ready for printing.
Now, my goal is to generate an Excel file that would be ready for printing.
 
Intouch has no native Excel support so you're going to have a hard time with this.

You're better off sticking with the CSV file and writinga macro in excel to import and format the file.
 
Maybe anyone has experience with that ExcelOperations object?
I'm experiencing timeout problems when I'm printing data to Excel file. I don't have many data, but it gets timed out anyway.
 

Similar Topics

Seems odd that you can make a symbol and place many of them but if the text on a button and or elsewhere in the symbol comes from a Custom...
Replies
0
Views
1,623
I was given some example code but I can not get the function to show up in the System Platform script. The dll import is successful but I'm...
Replies
1
Views
2,008
Hello Everyone! Need help with this... I have a controllogix plc 5571 which has just a USB port on it. I wish to read the data from this plc...
Replies
2
Views
2,377
Need your Advice. Scenario: I have got two SCADA computers at different locations which are having independent working plants at each site (But...
Replies
7
Views
2,929
Hi all, This is my first System Platform 2017 install. Have done plenty of mods to existing 2014 R2 installs and know what I'm doing in terms of...
Replies
3
Views
5,030
Back
Top Bottom