Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Help with Fetching Backwards through a table

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help with Fetching Backwards through a table

    I've been stuck on this one for several days now, I am missing something, but don't know what. I need a new pair of eyes to help me solve the problem.
    Rasion d'etre for the script.

    I am importing Aircraft Histories written in Excel into a table, The format of the spreadsheet is that each REG field has its own line of information. I am trying to automate the sequence of converting all the lines of a corresponding MSN into one record in the Table. [See attached PDF of Table]. I can explain better if you have the PDF in front of you.

    1. right-click on the records with a blue background and run script from a small Right_click Menu with the script name on it.

    2. I want the script to fetch_prev though the table while field MSN is blank, keeping the REG field value and adding each old one to the Old_id field as well as carrying backwards any values in the Op_name SUB and STATUS fields.


    the records with the grey and Blue background to be deleted after being processed by the script.

    the result I am after is to have just line with red font [on the pdf example] with all the info from the deleted lines.


    My code so far is as follows:

    Code:
    tbl = table.current()
    idx = tbl.index_primary_put()
    tbl.query_detach_all()
    dagger:
    dim CurrentReg    as c = current(tbl.reg)
    dim CurrentMsn    as c = current(tbl.msn)
    dim CurrentOper   as c = current(tbl.op_name)
    dim CurrentStatus as c = current(tbl.status)
    dim CurrentSub    as c = current(tbl.sub)
    dim CurrentOldId  as c = current(tbl.old_id)
    IF ut(CurrentMsn) = "" THEN
    	tbl.fetch_prev()
    	IF ut(CurrentReg) = "" THEN
    		tbl.change_begin()
    		tbl.op_name = CurrentOper
    		tbl.status  = CurrentStatus
    		IF ut(CurrentSub) <> "" THEN
    			tbl.sub = CurrentSub
    		END IF
    		tbl.change_end(.t.)
    	ELSE
    		dim PrevReg as c = current(tbl.reg)
    		IF ut(CurrentOldId) = "" THEN
    			Nod = ""
    		ELSE
    			Nod = "," + ut(CurrentOldId)
    		END IF
    		tbl.change_begin()
    		IF isblank("tbl.old_id") THEN
    			tbl.old_id =  ut(PrevReg) + nod
    		ELSE
    			tbl.old_id = ut(tbl.old_id) + "," + ut(PrevReg) + nod
    		END IF
    		tbl.status = CurrentStatus
    		tbl.op_name = CurrentOper
    		tbl.Reg = CurrentReg
    		IF ut(CurrentSub)<> "" THEN
    			tbl.sub = ut(CurrentSub)
    		END IF
    		tbl.change_end(.t.)
    	END IF
    	tbl.fetch_next()
    	tbl.change_begin()
    	tbl.delete()
    	tbl.change_end(.t.)
    	topparent.refresh_layout()
    	sys_send_keys("{up}")
    	tbl.fetch_prev()
    END IF
    CurrentMsn = current(tbl.msn)
    IF ut(CurrentMsn) = ""
    	goto dagger
    END IF
    thanks in anticipation

    P.S [Added later]

    I can only get the script to do 2 iterations beford it ends. It works if I keep clicking away on the right-click menu, so I think the logic is basically sound, it's the code in the last IF.. THEN statement that is causing me problems, its something to do with recno() I think, but am clutching at straws now.
    Last edited by Graham Wickens; 11-24-2006, 01:32 PM. Reason: Additional Information
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

    #2
    Re: Help with Fetching Backwards through a table

    Graham, once again, cannot debug this without having the data. Best wild guess is that you're overlooking fact that <tbl>.delete() will automatically fetch the next record. -- tom

    Comment


      #3
      Re: Help with Fetching Backwards through a table

      Here are the files.
      --
      Support your local Search and Rescue Unit, Get Lost!

      www.westrowops.co.uk

      Comment


        #4
        Re: Help with Fetching Backwards through a table

        Graham,

        (1) after the script runs correctly what will the line for MSN = 19650 contain in each column?

        2) what color is the row for REG N831FT in your PDF?

        3) what color is the row for REG N741SJ in your pdf ?

        4) will the field widths for OP_Name, sub, status, and Old_ID be sufficient to hold all the data you may need to retain?

        -- tom

        Comment


          #5
          Re: Help with Fetching Backwards through a table

          I've changed the name of your table and the saved browse layout, substituting hard underscores for the blanks you were using. Blanks can be troublesome in object names. I recommend you never use them.

          Your database is not portable because the tables are found in a different folder than the ADB dictionary file for the database. I recommend you store the tables in the same folder as the ADB dictionary file for the database. It seems a bit messier perhaps but automatic portability is gained.

          In any case here's an example script which starts at whatever row has been currently selected in your saved browse layout. It's activated from a right click menu choice which "plays" the saved script. When activated the script fetches previous records until it hits a record that does not have an empty MSN field. It aggregates field values as this occurs, and when the MSN populated record is finally reached, it writes the accumulated field values to the record. It then reverses direction and begins fetching down through the table deleting records as it goes, until it hits a row with an MSN field that is not blank. The display is then refreshed.

          This probably isn't exactly what you want, but is the best I can do given how I'm interpreting what you've described. Hope it helps.

          Code:
          'Date Created: 24-Nov-2006 03:07:02 PM
          'Last Updated: 24-Nov-2006 04:08:31 PM
          'Created By  : Test1
          'Updated By  : Test1
          
          'begin by confirming that Work_file_prod_list is open
          if .not. is_object(":work_file_prod_list") then
              msgbox("Oops","This script is intended to be called from the Right Click Menu in the Work_File_Prod_list browse layout")
              end
          end if
          '
          'begin by validating beginning row.  MSN must be blank.
          
          tbl = table.current()  'get pointer to table supporting the browse layout
          tbl.index_primary_put()  'record number sort seq
          
          vc_msn = trim(tbl.msn)
          if len(vc_msn) <> 0 then
              msgbox("Oops","This script rolls up the rows without an MSN.  You must select a row with a blank MSN to begin.")
              end
          end if
          
          'get here only if starting row has empty MSN
          dim vn_begin_rec as N = tbl.recno()
          dim vc_old_id as C = ""
          dim vc_op_name as C = ""
          dim vc_sub as C = ""
          dim vc_status as C = ""
          
          while vc_msn = "" .and. .not. tbl.fetch_eof()
          	if trim(tbl.reg) = "" then 
          		vc_old_id = vc_old_id + "No Reg,"
          	else	
          		vc_old_id = vc_old_id + trim(tbl.reg)+","
          	end if
          	
          	if trim(tbl.op_name) = "" then
          	    vc_op_name = vc_op_name + "No Op_name,"
          	else
          		vc_op_name = vc_op_name + trim(tbl.op_name) +","
          	end if
          	
          	if trim(tbl.sub) = "" then
          	    vc_sub = vc_sub + "No sub,"
          	else    
          		vc_sub = vc_sub + trim(tbl.sub) + ","
          	end if
          	
          	if trim(tbl.status) = "" then
          	    vc_status = vc_status + "No status,"
          	else    
          		vc_status = vc_status + trim(tbl.status)+","
          	end if
          	
          	tbl.fetch_prev()
          	vc_msn = trim(tbl.msn)
          end while
          
          'script assumes top of file contains a filled MSN field
          tbl.change_begin()
          tbl.old_id = left(vc_old_id,len(vc_old_id)-1)  'trim trailing comma
          tbl.op_name = left(vc_op_name,len(vc_op_name)-1)
          tbl.sub = left(vc_sub,len(vc_sub)-1)
          tbl.status = left(vc_status,len(vc_status)-1)
          tbl.change_end(.t.)
          
          'now step down through the records deleting each until we hit next record that has a populated MSN field
          tbl.fetch_next()
          while trim(tbl.msn) = "" .and. .not. tbl.fetch_eof()
          	tbl.change_begin()
          	tbl.delete()
          	tbl.change_end(.t.)
          	'no need to fetch next record.  record pointer will advance automatcally
          end while
          
          xbasic_wait_for_idle()
          tbl.fetch_prev()  'move rec pointer back to the rec with MSN populated
          :Work_File_Prod_List.resynch()
          :Work_File_Prod_List.refresh_layout()
          
          end

          Comment


            #6
            Re: Help with Fetching Backwards through a table

            Tom,

            I like your approach.

            I made a view adjustments/fine tuning according to my reading of the requirements. (from the pdf)

            I believe only the old_id field needs to have the data aggregated. Which does not include the first record processed and does include the last record which contains a value in the msn field.
            The reg field should end up with the value from the reg field in the first record.
            Ditto for the op_name field
            Ditto for the status field
            The sub field looks like it should end up with the first non blank value that it finds.

            Code:
            'Date Created: 24-Nov-2006 03:07:02 PM
            'Last Updated: 26-Nov-2006 01:20:17 AM
            'Created By  : Test1
            'Updated By  : Tim
            
            'begin by confirming that Work_file_prod_list is open
            if .not. is_object(":work_file_prod_list") then
                msgbox("Oops","This script is intended to be called from the Right Click Menu in the Work_File_Prod_list browse layout")
                end
            end if
            '
            'begin by validating beginning row.  MSN must be blank.
            
            tbl = table.current()  'get pointer to table supporting the browse layout
            tbl.index_primary_put()  'record number sort seq
            
            vc_msn = trim(tbl.msn)
            if len(vc_msn) <> 0 then
                msgbox("Oops","This script rolls up the rows without an MSN.  You must select a row with a blank MSN to begin.")
                end
            end if
            
            'get here only if starting row has empty MSN
            
            ' make sure pointer is at last record in group with no msn value
            while vc_msn = "" .and. .not. tbl.fetch_eof()
                tbl.fetch_next()
                vc_msn = trim(tbl.msn)
            end while
            
            If .not. tbl.eof() then
               tbl.fetch_prev()
               vc_msn = ""
            end if
                
            dim vn_begin_rec as N = tbl.recno()
            dim vc_old_id as C = ""
            dim vc_op_name as C = tbl.op_name   ' this data only needed from the first record processed
            dim vc_sub as C = ""
            dim vc_status as C = tbl.status     ' ditto
            dim vc_reg as C = tbl.reg            ' ditto
            
            
            if trim(tbl.sub) <> "" .and. vc_sub = "" then
                vc_sub = trim(tbl.sub)
            end if
            '  the first record has now been processed so fetch prev record before starting while loop
            tbl.fetch_prev()
            
            while vc_msn = "" .and. .not. tbl.fetch_eof()
                if trim(tbl.reg) = "" then 
                    vc_old_id = vc_old_id 
                else    
                    vc_old_id = trim(tbl.reg)+ ", " + vc_old_id
                end if
                
                if trim(tbl.sub) <> "" .and. vc_sub = "" then
                    vc_sub = trim(tbl.sub)
                end if
                
                tbl.fetch_prev()
                vc_msn = trim(tbl.msn)
            end while
            
            'script assumes top of file contains a filled MSN field
            tbl.change_begin()
            tbl.old_id = rtrim(trim(tbl.reg)+ ", " + vc_old_id,", ")  'trim trailing comma and space if it is there
            tbl.op_name = vc_op_name
            tbl.sub = vc_sub
            tbl.status = vc_status
            tbl.reg = vc_reg
            tbl.change_end(.t.)
            
            'now step down through the records deleting each until we hit next record that has a populated MSN field
            tbl.fetch_next()
            while trim(tbl.msn) = "" .and. .not. tbl.fetch_eof()
                tbl.change_begin()
                tbl.delete()
                tbl.change_end(.t.)
                'no need to fetch next record.  record pointer will advance automatcally
            end while
            
            xbasic_wait_for_idle()
            tbl.fetch_prev()  'move rec pointer back to the rec with MSN populated
            :Work_File_Prod_List.resynch()
            :Work_File_Prod_List.refresh_layout()
            
            end
            Tim Kiebert
            Eagle Creek Citrus
            A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

            Comment


              #7
              Re: Help with Fetching Backwards through a table

              Tim, you may be right. Graham hasn't clarified things yet. In his original post he said:
              I want the script to fetch_prev though the table while field MSN is blank, keeping the REG field value and adding each old one to the Old_id field as well as carrying backwards any values in the Op_name SUB and STATUS fields.
              I have assumed that "carrying backwards" means retaining all the field values, though it's clear that's not what his own sample PDF illustrated. We can get this sorted once he gives us a sufficiently detailed description of what he needs in each column. Was an interesting exercise (though some would say that means my personal entertainment threshold needs radical adjustment!).

              -- tom

              Comment


                #8
                Re: Help with Fetching Backwards through a table

                Graham:
                right-click on the records with a blue background and run script from a small Right_click Menu
                You do not need to do this backward, you could do it backward or forward, probably easier forward.

                It is not much of an automation if you have to keep pointing to blue rows to consolidate the rows. You could do the whole thing in one shot and be done with it.

                I tried to open your zip file, but you did not include the pdf table.

                Here is a sample code moving forward and consolidating the rows:
                Code:
                dim vmsn as c
                dim vold as c
                
                t=table.open("..")
                while t.eof()=.f.
                while table->msn<>""
                vmsn=table->msn
                vold=table->old_ID+vold
                t.fetch_next()
                while table->msn=""
                t.change_begin()
                t.msn=vmsn
                t.old_ID=table->old_id+vold
                t.change_end()
                t.fetch_prev()
                t.delete()
                t.fetch_next()
                end while
                end while
                end while
                t.close()
                Didn't test it, might need some tweaking but you get the idea.
                Last edited by G Gabriel; 11-25-2006, 02:45 PM.

                Comment


                  #9
                  Re: Help with Fetching Backwards through a table

                  I can't figure out exactly what the outcome is supposed to be either. The PDF is not consistent. My scribble picture points out inconsistencies.

                  The PDF appears to have the compiled record at the beginning of the series (top). For this to happen in a table, it would have to be a record line that already exists and is amended. There does not appear to be an existing record to accept such amendments in the table provided. So which existing record is to receive the compiled field values? Or is it a new record?

                  Mike W
                  Mike W
                  __________________________
                  "I rebel in at least small things to express to the world that I have not completely surrendered"

                  Comment


                    #10
                    Re: Help with Fetching Backwards through a table

                    Tom, in my defence, the files are all in the same directory on the "Live" database, I setup a "Testing" database and added the relevant files for my question.

                    I am not sure if I mislead anyone as I have not gone though all the thread yet, here in the UK it is now 21:30, a fresh brain in the morning is needed.

                    does it explain things a bit better if I say that in the PDF example, Lines 1 and 2 are the same physical record on in the table, line 1 being the end result of running the script and line 2 being the original field values before the script was run, I put them both in thinking I was making it clearer. read the same for 8 and 9, 13 and 14 where the red font is the end result and grey backgrounds are the original field values in each case. the end result of the Old_id field is the cocatenation of all the different REG field carried by the aircraft with that particular MSN and is a concatenation of all the reg that the script finds as it works backwards to the record with the MSN value. So instead of each REG value being in a different record (as it was on the original imported XLS file, they are all in one record.

                    Get back to you all tomorrow,

                    many thanks.
                    Last edited by Graham Wickens; 11-25-2006, 05:43 PM. Reason: Additional Info
                    --
                    Support your local Search and Rescue Unit, Get Lost!

                    www.westrowops.co.uk

                    Comment


                      #11
                      Re: Help with Fetching Backwards through a table

                      Graham, no "defense" needed. Did not mean to be "attacking". Just offering recommendations. The fact that the testing database you created had tables split from the ADB dictionary directory meant that those of us trying to help had to figure out why your example would not open on our systems, that's all.

                      When you get back to this using a specific MSN field value (from the sample you posted here) tell us what specific values you want placed in each of the columns the script should modify in that same row.

                      Do you envision having the sequence repeat for each separate aircraft in the table?

                      Comment


                        #12
                        Re: Help with Fetching Backwards through a table

                        Here is my new and improved version. Actually, the fixed up my mistakes version. Thanks to Mike for pointing out the difference in the results between the different aircraft. I initially just went by the first one. (Really fancy graphics you're using Mike :D)

                        Tom, Yes I'm also finding it an interesting exercise. That might mean that my "personal entertainment threshold" is also in need of some attention.

                        Code:
                        'Date Created: 24-Nov-2006 03:07:02 PM
                        'Last Updated: 26-Nov-2006 03:55:04 PM
                        'Created By  : Test1
                        'Updated By  : Tim
                        
                        'begin by confirming that Work_file_prod_list is open
                        if .not. is_object(":work_file_prod_list") then
                            msgbox("Oops","This script is intended to be called from the Right Click Menu in the Work_File_Prod_list browse layout")
                            end
                        end if
                        '
                        'begin by validating beginning row.  MSN must be blank.
                        
                        tbl = table.current()  'get pointer to table supporting the browse layout
                        tbl.index_primary_put()  'record number sort seq
                        
                        vc_msn = trim(tbl.msn)
                        if len(vc_msn) <> 0 then
                            msgbox("Oops","This script rolls up the rows without an MSN.  You must select a row with a blank MSN to begin.")
                            end
                        end if
                        
                        'get here only if starting row has empty MSN
                        
                        ' make sure pointer is at last record in group with no msn value
                        while vc_msn = "" .and. .not. tbl.fetch_eof()
                            tbl.fetch_next()
                            vc_msn = trim(tbl.msn)
                        end while
                        
                        If .not. tbl.eof() then
                           tbl.fetch_prev()
                           vc_msn = ""
                        end if
                            
                        dim vn_begin_rec as N = tbl.recno()
                        dim vc_old_id as C = ""
                        dim vc_op_name as C = tbl.op_name   ' this data only needed from the first record processed
                        dim vc_sub as C = alltrim(tbl.sub)
                        dim vc_status as C = tbl.status     ' ditto
                        dim vc_reg as C = alltrim(tbl.reg)           
                        
                        
                        '  the first record has now been processed so fetch prev record before starting while loop
                        msgbox("1",tbl.line_no)
                        tbl.fetch_prev()
                        vc_msn = tbl.msn
                        msgbox("2",tbl.line_no)
                        while vc_msn = "" .and. .not. tbl.fetch_eof()
                            msgbox("in while",tbl.line_no)
                            IF vc_reg = "" then
                                vc_reg = trim(tbl.reg)
                            else
                                IF trim(tbl.reg) <> "" THEN
                                    vc_old_id = trim(tbl.reg)+ ", " + vc_old_id
                                END IF
                            END IF
                                
                            if vc_sub = "" then
                                vc_sub = trim(tbl.sub)
                            end if
                            
                            tbl.fetch_prev()
                            vc_msn = trim(tbl.msn)
                        end while
                        
                        'script assumes top of file contains a filled MSN field
                        tbl.change_begin()
                        tbl.old_id = iif(vc_reg = "","",rtrim(trim(tbl.reg)+ ", " + vc_old_id,", "))  'trim trailing comma and space if it is there
                        tbl.reg = iif(vc_reg = "",tbl.reg,vc_reg)
                        tbl.op_name = vc_op_name
                        tbl.sub = iif(vc_sub = "",tbl.sub,vc_sub)
                        tbl.status = vc_status
                        tbl.change_end(.t.)
                        
                        'now step down through the records deleting each until we hit next record that has a populated MSN field
                        tbl.fetch_next()
                        while trim(tbl.msn) = "" .and. .not. tbl.fetch_eof()
                            tbl.change_begin()
                            tbl.delete()
                            tbl.change_end(.t.)
                            'no need to fetch next record.  record pointer will advance automatcally
                        end while
                        
                        xbasic_wait_for_idle()
                        tbl.fetch_prev()  'move rec pointer back to the rec with MSN populated
                        :Work_File_Prod_List.resynch()
                        :Work_File_Prod_List.refresh_layout()
                        
                        end
                        Tim Kiebert
                        Eagle Creek Citrus
                        A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                        Comment


                          #13
                          Re: Help with Fetching Backwards through a table

                          Tim your revised script plus a couple of edits by me did the job.

                          I liked Gabriel's suggestion of just running a script against the whole table as I have about 30 odd excel files to run into A5 each month, but I could not get the script to give the satisfactory result I was seeking.

                          Attached is a new PDF file which hopefully will show what I am trying to do.

                          with the PDF in front of you...

                          record 6 is where I right-click to start script. the before and after lines are each record's values before and after script processing. When the script has finished, records 2 through 6 are to be deleted, leaving record 1 with all the relevant data from the deleted ones.

                          Something I over looked in the original description is that if The REG field is blank, it implies that only the OP_NAME has changed, the REG value will be the same as the previous values set for REG.

                          see record "2 before" in PDF example. the REG field value is implied as N741PA as in Record "1 before".

                          Would I be able to get the Tim's script to process the whole file is I can merge if with Gabriel's? As some of you might know I am a self-taught amateur and might need some help to do this as well.
                          Last edited by Graham Wickens; 11-26-2006, 08:46 AM. Reason: correct spelling, added further question
                          --
                          Support your local Search and Rescue Unit, Get Lost!

                          www.westrowops.co.uk

                          Comment


                            #14
                            Re: Help with Fetching Backwards through a table

                            Graham,

                            A couple of notes on my last revised code.

                            From the testing I did it should allow for initial blank reg fields as you mention and also blanks along the process. ie the final result for the reg field is the first non blank reg field that gets encountered. After that the reg fields get put into the old id field. further blank reg fields get ignored so as not to put unnecessary empty space in the old id field. The same process is applied to the sub field: using the first non blank field in the final result.

                            Another 'feature' i put in is you can start the process on any record below the the msn record and it will scan down till the next msn record and then back up one. That way you can be sure that you get all the records. Otherwise if you inadvertently start on the wrong record you get a bit of a mess. You can't just rerun the script to pick up the forgotten record.

                            The code in your latest sample app doesn't seem to be any different than your previous one. Did you upload the correct version?

                            The latest PDF you supplied still implies that you are writing to each record as you go along. This is completely unnecessary. Just let the variables collect the data and write once when you get to the msn record.

                            AS far as automating it so the whole table is done at once goes I actually developed the script to accomplish that but I left it on my work computer:(. I will be back there in about five hours. ( short sleep tonight) I will post it then.
                            Tim Kiebert
                            Eagle Creek Citrus
                            A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                            Comment


                              #15
                              Re: Help with Fetching Backwards through a table

                              Graham,

                              In "line 1 AFTER" of your PDF (today), where do the field values come from for "REG", "Op_Name" and "SUB" fields?

                              Comment

                              Working...
                              X