Sign in to follow this  
Followers 0
electro1212

Problem with GenerateReport

5 posts in this topic

Hi, I'm very new user with cx-supervisor. I am trying to generate html report with cx-supervisor. It's successfull, but i just want to have a variable name of report each time. I want to have a report name like this Production Report 22-10-2013 8h50.html ( Production Report (( DATE )) (( Time )).html ) or something like that. i've tryied GenerateReport "c:\Test.html","c:\Test1"$Date".html" but it's not ok Please help me to find the correct vb script.

Share this post


Link to post
Share on other sites
try something like this: Since system points $Date and $Time contains forbidden characters for Windows file name (like : or /) you should create textual point with date and time. I use the following: MyYear = ValueToText($Year) MyMonth = ValueToText($Month) IF ($Month < 10) THEN MyMonth = "0" + MyMonth ENDIF MyDay = ValueToText($DayOfMonth) IF ($DayOfMonth < 10) THEN MyDay = "0" + MyDay ENDIF MyHour = ValueToText($Hour) IF ($Hour < 10) THEN MyHour = "0" + MyHour ENDIF MyMinute = ValueToText($Minute) IF ($Minute < 10) THEN MyMinute = "0" + MyMinute ENDIF MySecond = ValueToText($Second) IF ($Second < 10) THEN MySecond = "0" + MySecond ENDIF 'Adding 0 is for name of the reports to have dates and times with same number of characters so windows sort report files accordingly. ReportName = "Report_" + MyYear + "-" + MyMonth + "-" + MyDay +"-" + MyHour+ "-" + MyMinute + "-" + MySecond + ".html" ReportTemplate = "c:\Test.html" GenReport_Flag = GenerateReport(ReportTemplate, $ProjectPath + "\" + ReportName) If you use VBScript then add strings using & instead of +. Regards Edited by tashinz

Share this post


Link to post
Share on other sites
Hi Guys. I have an urgent question on the same topic on cx-supervisor. I have an integer point that reads the value of H10 holding area (which is my cycle number) How can I get that cycle number to display as my report name? Currently I create my report as follows: GenerateReport "c:\reports\template1\machine1.csv","c:\reports\machine1\report1.csv" My report is created perfectly as an csv, but the name is now report1. Now every time it creates a new report, it just overwrites the old one. Would it be possible to get my cycle number value in H10 to display after the Report1on the file name? Best regards Neels

Share this post


Link to post
Share on other sites
Don't use fixed path for destination of the report (like "c:\reports\machine1\report1.csv") but use text point which you can fill with characters freely, or you can use combination of text point and fixed part like MyTextPoint + "MyReport.csv". All this in GenerateReport command. or you can do what you did, and the use CopyFile command to copy your report to another or same folder but with different name.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0