Desktop productivity for business analysts and programmers

Auto Purge Project Log in EG

Reply
Highlighted
Regular Contributor
Posts: 155

Auto Purge Project Log in EG

Good morning everyone.

 

I am curious if anyone has found a way to use code in EG to auto purge the project log when it is nearing the size limit.  It would be nice to do this rather than it failing on a scheduled job and having to go in and clear the log manually before rerunning the process flow.  Not sure it can be done but worth a shot to ask and see if anyone is doing it somehow.

SAS Employee
Posts: 182

Re: Auto Purge Project Log in EG

Posted in reply to elwayfan446

Hi @elwayfan446

 

I don't think what you're looking for exists.

You can either use Chris' solution here or turn it off using the View => Project Log menu.

 

Hope that helps (but I know this isn't the answer you wanted Smiley Wink ).

 

Cheers,
Damo

 

Regular Contributor
Posts: 155

Re: Auto Purge Project Log in EG

Thanks @Damo.  I normally use the same solution that Chris does because I use the information in the log so I don't want to turn it completely off.  I was pretty sure it couldn't be automated but wanted to see if someone figured out a way before I completely wrote it off.

 

 

SAS Super FREQ
Posts: 350

Re: Auto Purge Project Log in EG

[ Edited ]
Posted in reply to elwayfan446

Hi @elwayfan446,

 

Actually, there is a way...  starting in EG 7.15, you can perform Project Log operations (enable/disable, get the log text, save to file, send email, or clear) via the EG automation interface. Here is an example of the Project Log related calls you could make in a VBScript (or PowerShell script, but different syntax):

 

	Set objProjectLog = objProject.ProjectLog
	objProjectLog.Clear()

	' Other optional operations
	'objProjectLog.Enabled = True
	'strProjectLog = objProjectLog.Text
	'objProjectLog.SaveAs "c:\temp\projectLog.txt"
	
	'toList(0) = "me@here.com"
	'objProjectLog.SendMail "", "", toList, ccList, "my subject", "my body text"

 

A common use would be to add a Clear call to a scheduled .vbs file (and optionally save the project log out before clearing).

 

In a future release, we'd like to expose more options directly in the UI for automatically managing the size of the project log.

 

Casey

Regular Contributor
Posts: 155

Re: Auto Purge Project Log in EG

Posted in reply to CaseySmith

Thank you @CaseySmith.  This looks promising.  Can you clarify what you mean when you say "via the EG automation interface"?  I am trying to figure out how I can call the VBScript or Powershell code and it be able to work inside EG. 

 

Thanks!

SAS Super FREQ
Posts: 350

Re: Auto Purge Project Log in EG

Posted in reply to elwayfan446

Sure, here are example steps that show how the EG automation interface is used to run a project (on a schedule in this case):

  1. In EG, click File->New->Project to create a new project.
  2. Click File->New->Program to create a new program.
  3. Copy/paste this code into your program:

    proc print data=sashelp.class; run;

  4. Click File->Save Project to save the EG project.
  5. Click File->Schedule <projectName>.
  6. Click OK in the scheduler dialog to dismiss it with defaults. (A EGScript1.vbs file will then be created in same directory as your .egp file, and a Windows Scheduled Task will be created that runs the EGScript1.vbs file.)
  7. Look in the same directory where your EG project file (.egp) was saved and locate the new EGScript1.vbs file (VBScript).
  8. Close EG.
  9. Double-click the EGScript1.vbs file to run it, or run it from command-line. Note: If you have 32-bit EG on 64-bit Windows, you'll need to run it from command-line via "c:\windows\SysWOW64\cscript.exe <fullpath>\EGScript1.vbs".
  10. Re-open your saved .egp project in EG and confirm it ran (there is now an output node attached to the program in the process flow).
  11. Open the EGScript1.vbs file into a text editor to inspect and edit the VBScript code (ex. add commands similar to those I shared earlier for working with the Project Log).
  12. Close EG, re-run the EGScript1.vbs file again (with the desired edits), and confirm it performed the desired operations.

You can manually run the EGScript1.vbs file or schedule it to be run in Windows Task Scheduler.

 

Casey

Regular Contributor
Posts: 155

Re: Auto Purge Project Log in EG

Posted in reply to CaseySmith

Ah, ok.  I am with you on that part. I have several processes already scheduled this way.  I was interested in the code such as powershell to actually do the purge and then I was going to definitly schedule to run once a month or so.

 

Thanks for the help!

SAS Super FREQ
Posts: 350

Re: Auto Purge Project Log in EG

Posted in reply to elwayfan446

Here is an example of using the EG automation interface from PowerShell:

 

$projectList = @('C:\temp\deleteme\Project1.egp','C:\temp\deleteme\Project2.egp') 
foreach($project in $projectList) { 
    Write-Host "Start processing of " $project 
    $eguideApp = New-Object -ComObject SASEGObjectModel.Application.7.1 
    $egProject = $eguideApp.Open("$project","") 
    $egProject.run() 
    $egProject.save() 
    $egProject.close() 
    $eguideApp.Quit() 
    Write-Host "Ended processing of " $project 
}

Same objects and methods are available (since registered COM interfaces), just PowerShell syntax. The script above opens, runs, saves, then closes two EG projects, one after the other.

 

 

Casey

Regular Contributor
Posts: 155

Re: Auto Purge Project Log in EG

Posted in reply to CaseySmith

Thanks Casey!  This is very useful to have.  I can definitely think of some ways to use this. I have only ever done it using the built in schedule tool.

 

However, when I mentioned powershell, the need is for the code that does the actual purging, not necessarily runs the EG project.  Sorry for the confusion.

Ask a Question
Discussion stats
  • 8 replies
  • 143 views
  • 1 like
  • 3 in conversation