Quantcast
Channel: SCN : Unanswered Discussions - Data Services and Data Quality
Viewing all articles
Browse latest Browse all 3719

Python if ... else

$
0
0

Hi,

Is it possible to do an if..else statement using Python?

 

This is what I currently have:

 

IF (($G_FileFound = 1) )

BEGIN

$G_Counter = 1;

WHILE (($G_Counter <= $G_NumOfFiles) )

    BEGIN

    

  sql('DS_Datastore', 'INSERT INTO [$G_Schema_Name].[$G_Audit_Table](FILE_SOURCE, FILE_VENDOR, FILE_LOCATION, FILE_NAME,FILE_DATE_TIME,ERROR_FILE_NAME,STAGE_FILE)

                       VALUES ({$G_SOURCE},{$G_VENDOR},{$G_FileLocation},{$G_File_Name},{$G_File_Date},{$G_Failed_Records_File},\'Y\')');

  $G_Counter = ($G_Counter + 1);

      

END

END

 

 

What I want to do is add an ELSE to notify me no files were found:

 

IF (($G_FileFound = 1) )

BEGIN

$G_Counter = 1;

WHILE (($G_Counter <= $G_NumOfFiles) )

    BEGIN

    

  sql('DS_Datastore', 'INSERT INTO [$G_Schema_Name].[$G_Audit_Table](FILE_SOURCE, FILE_VENDOR, FILE_LOCATION, FILE_NAME,FILE_DATE_TIME,ERROR_FILE_NAME,STAGE_FILE)

                       VALUES ({$G_SOURCE},{$G_VENDOR},{$G_FileLocation},{$G_File_Name},{$G_File_Date},{$G_Failed_Records_File},\'Y\')');

  $G_Counter = ($G_Counter + 1);

      

END

END

ELSE

  Print('No File found');

END

 

I can't seem to get the syntax correct.

Has anyone done this before?
TIA


Viewing all articles
Browse latest Browse all 3719

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>