4 Replies Latest reply on Feb 11, 2009 5:32 AM by ninja

    Script that looks at two files



      Script that looks at two files


      Hi All


      I have two separate files and a script that goes to one file and searches for a date range and then sorts, then goes to the other file, does the same find, then sorts.  It then goes to a layout in the second file which references one field from the first file.  The problem is that the field reports the total from the entire file, not from the found set.  Is there a way to make it just look at the found set?





        • 1. Re: Script that looks at two files

          howdy jmhoward,

          Thanks for the post and welcome.


          While there may be a more direct way of doing it, the way I use is this:


          Link a Table Occurrence by the normal identifier you use AND another field (Newfield).  In your script, after you find the foundset, replace the contents of Newfield with something (the word "banana" for example) .


          In your second file, have a global field (newfieldtoo) that is set to "banana".


          Now you have a dynamic "linked set" based upon your "found set".  From your second file, you can do a Sum() calculation and get your total of all the "linked set".


          If you go this route, remember to clear the word "banana" out of the file1 Newfield or your relationship will go ape:P.

          • 2. Re: Script that looks at two files

            Hi Ninja


            Thanks for the reply.  I am trying to make it work, but it still is looking at the entire file, rather than the found records, so I must be doing something wrong.  Do I have to change my sort or anything like that?



            • 3. Re: Script that looks at two files

               Hi JmHoward


              i had to do this last week, i solved it by creating a "Search date from" and "a search date to" global date field in the database that you are running the report from. Then in each of your databases that you are searching in, create a field which uses a dual IF command to insert a "1" if greater than search date from and less than search date to, set the else if argument to "" so that it remains empty. Then use the rest of your script to count or lookup what information you need.


              hope that helps.



              • 4. Re: Script that looks at two files

                howdy again,


                Andyg4137 is forming the relationship the same way (but a little different) and both would work.  Andyg used the number 1 instead of the word banana, but the concept is still the same.  Instead of trying to total across multiple found sets, you are tagging the records and then totalling the tagged records.


                Assuming that they are tagged with "banana",

                and that you've created a global field with "banana" in it in your main table.

                The relationship with the other Dbase Table Occurences needs to be your normal linkage and the "tagging fields"

                (UniqueID to UniqueID) AND (MainTable::Bananafield  to  OtherTable::bananafield)  In this way it connects only the related records, and even of those only the tagged records.


                You'll need to have your total be

                = Sum(OtherDbase1::Field) + Sum(OtherDbase2::Field)


                In my use, I have the other Dbase records portaled in.  I'm not sure if this is required or not...I've never tried this without portaling it in.  My gut says that the portal in is needed (but you can make it tiny and non-printing if you don't want to see it).


                How are we doing?