Script package action enables the implementation of advanced checks and validations.
Two languages are supported:
Var I : Integer;
begin
I:=1;
SetVariable('I',I);
I:=GetVariable('I');
WriteToLog('Error',I);
Result:=True;
end;Result:=True; => Success
Result:=False; => Failureimport etltools
etltools.SetVariable('<Time>',15)
s=etltools.GetVariable('<Name>')
etltools.WriteToLog('Done')
Result.Value = 0Result.Value = 1 => Success
Result.Value = 0 => Failure
The Variables tab defines the variables to be updated during the action’s execution.
The Execution log tab is populated after the action is executed. Double click on the row to view the log.
var
CrystalRFileName: String;
ExportFileName: String;
CrystalRApplication, CrystalReport: Variant;
begin
CrystalRFileName := GetVariable('<CrystalRFileName>') ;
ExportFileName := GetVariable('<ExportFileName>') ;
CrystalRApplication := Null;
CrystalReport := Null;
try
CrystalRApplication := CreateOleObject('CrystalRunTime.Application');
CrystalReport := CreateOleObject('CrystalRunTime.Report');
//Result := CrystalRApplication.GetVersion;
except
CrystalRApplication := Null;
CrystalReport := Null;
end;
If VarIsNull(CrystalRApplication) = False then
begin
try
//Result := CrystalRApplication.GetVersion;
try
CrystalReport := CrystalRApplication.OpenReport(CrystalRFileName);
CrystalReport.ExportOptions.FormatType := 31;
CrystalReport.ExportOptions.DiskFileName := ExportFileName;
CrystalReport.ExportOptions.DestinationType := 1;
CrystalReport.ExportOptions.PDFExportAllPages := True;
CrystalReport.Export(False);
Result := CrystalReport.ApplicationName;
except
CrystalReport := Null;
end;
finally
//Result := CrystalRApplication.CanClose;
Result := true;
end;
end;
end;import etltools, subprocess
def main():
try:
# Check if Excel is running
if subprocess.call('tasklist /FI "IMAGENAME eq excel.exe" | find /I /C "excel.exe"', shell=True) == 0:
# Excel is running, attempt to kill it
subprocess.run(['taskkill', '/F', '/IM', 'excel.exe'], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
etltools.SetVariable('excel_status', 'Excel was running and has been terminated.')
else:
# Excel is not running
etltools.SetVariable('excel_status', 'Excel was not running. No action taken.')
Result.Value = 1 # Success in both cases
except subprocess.CalledProcessError as e:
etltools.SetVariable('excel_status', f"Failed to kill Excel: {str(e)}")
Result.Value = 0 # Failure
except Exception as e:
etltools.SetVariable('excel_status', f"An unexpected error occurred: {str(e)}")
Result.Value = 0 # Failure
main()For more technologies supported by our ETL Software see Advanced ETL Processor Versions
Confused? Ask question on our ETL Forum