8 Replies Latest reply: Dec 5, 2013 11:06 AM by Traci Dukes RSS

    getfilename of the input file

      I have payroll dates in the input file which are .csv.  What I would like to do is parse the date out to store as Payroll date in the SQL Table.

      Is there anything like getfilename() in LUA.

       

       

      Thanks Traci Dukes

        • Re: getfilename of the input file
          Alan Farrell

          You can add this line to your script

           

          filename() as FileName

           

          this will pickup the filename from where you are taking your data

           

          you can see it in this video by Steve Dark from @quintelligence

           

          https://www.youtube.com/watch?v=VhaIaO156JM

            • Re: getfilename of the input file

              I am working in expressor not QlickView, expressor doesnt like it.

              I need the LUA equivalent of getfilename?

                • Re: getfilename of the input file

                  Do you mean that the file name includes the payroll date?

                   

                  This can be done by passing the name of the file in as a parameter. Then the code can access the value assigned to the parameter and parse out the date.

                   

                  Are you processing a single file or a collection of files in the same directory location?  If many files, you need some way to iterate through the collection.

                   

                  Suggest you look at the knowledge base article on the extension sdk. Using Expressor 3.9.1 or later you would be able to write an input operator that does exactly what you want.

                    • Re: getfilename of the input file

                      Hi John,

                        Yes the filename has the payroll date.  In this case I am only processing one file at a time.

                      Where would I find documentation on creating a parameter from the filename?

                        Thanks Traci

                        • Re: getfilename of the input file

                          You need to review the documentation topic Building Expressor QlikView Applications > Configurations to understand how to use the configuration artifact and parameterization.

                           

                          Then follow these guidelines as an aid.

                           

                          In the Properties sheet for the Read File operator, click the Actions button.

                          1.png

                          From the drop down menu, select Enter Parameter Name

                          2.png

                          In the popup window, give the parameter some meaningful name

                          3.png

                          Save the dataflow.

                          Create a configuration artifact and include one entry specifying the name of the file to process.

                          4.png

                          Then in code somewhere within the dataflow, you can retrieve the name of the file with the following

                          file_being_processed = expressor.NamedParameters.inputFile

                  • Re: getfilename of the input file

                    John,

                      I am getting ready to give this a try.  I just installed expressor 10 on another machine.   I am not able to import a zipped project from my current version are they not compatible?  Is there a way to import a project from 3.7.1.

                     

                    Thanks Traci