3 Replies Latest reply on Jul 2, 2009 9:02 AM by philmodjunk

    Best Practice??

    TKnTexas

      Title

      Best Practice??

      Post

      I have a file with 2 tables.  In AP when we generate the check register we spool it to a text file.  We want to evaluate the discounts earned vs taken on each check run.  In the first table I import the file, each text row to one field of the record.  Using text functions I have successfully been able to parse the data out to the proper fields.  The spooled files are named by the check date, ie apckrgMMDDYY.ap.  I want to prompt for the check date to a global field.  I created the file name. 

       

      In Table 1, it is a scratch table, nothing permanent is stored.  I want to truly automate the processes. 

      1) Delete all records in the scratch file.

      2) Prompt for check date.

      3) import file to scratch file, fill in check date to all records.  

      4) Find data records, blank rows and multple page header rows get imported.

      5) Move data records to permanent table.

       

      I have made a bunch of subroutines that could be tested separately.  Deleting the old records, works great.  Prompt for date works great. I go to a layout in the scratch file, where there are no records.  When I import, the records go to the permanent table.  I added steps to add a blank record to the scratch file after I go to the layout.  I go to the field for the import to start.  Then I do the import.  Then it works.  Is it really necessary to add the blank record and set the cursor to a field before the import will work? 

       

      I have really learned a lot doing this little project. I would appreciate any comments.   

        • 1. Re: Best Practice??
          philmodjunk
            

          "When I import, the records go to the permanent table.  I added steps to add a blank record to the scratch file after I go to the layout.  I go to the field for the import to start.  Then I do the import.  Then it works."

           

          I've imported data into cloned files (no records) with no problem. I'm not clear as to what difference in result you're getting when you import without "creating a blank record and going to the field" vs simply importing the records.

          • 2. Re: Best Practice??
            TKnTexas
              

            I was stumped on this.  I thought going to IMPORT LAYOUT which is in the empty scratch table would be a sufficient step to take me to the right table for importing the raw data records. But repeatedly they end up in the check register table.  Luckily the imported data remains the found set to easily delete. 

             

            Also, just adding a blank record to the scratch table was not sufficient.  I had to add the step of going to a field on that record. 

            • 3. Re: Best Practice??
              philmodjunk
                

              When you manually import data, you specify the target for your import by first selecting a layout that refers to the table you want to recieve your imported data.

               

              Let's say you want to import your data into a table named "scratch".

               

              Select a layout that lists "scratch" in its layout setup

              Do your import. In the Matching Fields Dialog, you'll see the name of the target table--the table that will receive your data listed on the right to confirm where the data will go.

               

              When you use a script, you need to specifiy the target table when you add that step to the script by clicking Specify... in the lower right corner. You can then select the desired table from the drop down in the top right corner of the import field mapping dialog that pops up.