VarianAPIs / Varian-Code-Samples

Code samples for ESAPI and other Varian APIs and web services.
MIT License
118 stars 107 forks source link

Exporting Patient´s Info to a file with the Patient´s ID as file name #78

Open ArturoGetas opened 4 years ago

ArturoGetas commented 4 years ago

Using the Visual Scripting tool in Eclipse is not possible to Export a Document with a Patient´s Name (e.g Excel Document with information of a Patient and with the Patient´s Name as file name). Exporting any Kind of report it´s going to be always a random Name for the file.

Is it possible to modify the "Action Packs" in Visual Scripting to fix this? There is maybe a different Approach to fix the Problem?

Kiragroh commented 4 years ago

I would not recommend VisualScripting because it is restricted in possibilities. It makes only sense if you have a specific and achievable use case in mind.

You can add something like this in your code (you have to adjust for your context):

// write the check results into csv file string filename = string.Format(@"D:\Patienten_{0} bis {1}.csv", startDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd")); using (System.IO.StreamWriter sw = new System.IO.StreamWriter(filename, false, Encoding.ASCII)) { // header for the report

            sw.WriteLine("Patient-ID, Nachname, Vorname, Course-ID, Linac, Plan-ID, Target-ID, BeamNumber, Technique, Fx, ED, GD, IDL%, Dmax, Physik-Approver, Arzt-Approver, Current Approval-Status, Treatment Approval-Date, Elements?, RefPoints, CourseState");

            sw.Write(msg);
        }
        System.Console.WriteLine("Results are saved in {0}", filename);
ArturoGetas commented 4 years ago

Thank you very much. I will try it !