Skip to Content
Author's profile photo Sagar Girme

Select source file runtime

Source files:

Capture.JPG

Define file format:

Capture.JPG

Simple Script to select particular source file runtime.

Capture.JPG

Passing value to Variable:

Capture.JPG

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Dirk Venken
      Dirk Venken

      There's no need for an if-then-else structure in the script to select the source file. You can get the same reults in 2 lines only:

           $G_File_Option = init_cap( nvl($G_File_Option, 'ALL'));

           $G_File_Name = 'Employee_Grade_'||$G_File_Option||'.xlsx';

      Author's profile photo Sagar Girme
      Sagar Girme
      Blog Post Author

      Yes, agree. In this case it is not necessary.

      But in case if we have options like 1,2,3 etc. then we can have if-then-else

      If ($G_File_Option=1)

      $G_File_Name = 'Employee_Grade_Pune.xlsx';

      Else

           If ($G_File_Option=2)

           $G_File_Name = 'Employee_Grade_Chennai.xlsx';

           Else

                If ($G_File_Option=3)

                $G_File_Name = 'Employee_Grade_London.xlsx';

                Else

                $G_File_Name ='Employee_Grade_All.xlsx';

      Author's profile photo Dirk Venken
      Dirk Venken

      Or in 1 line:

           $G_File_Name = 'Employee_Grade_'||decode($G_File_Option=1,'Pune',$G_File_Option=2,'Chennai',$G_File_Option=3,'London','All')||'.xlsx';

      Author's profile photo Sagar Girme
      Sagar Girme
      Blog Post Author

      Ultimately Decode and If-Then-Else doing same thing, one in single line and other in simplified way.