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

Basic Append Question

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

  • Basic Append Question

    Hi. I'm trying something new, which may be pretty basic, I am not sure. I am becoming more familiar with Alpha 5 every day and have learned a lot through the mistakes I've made. I'd like to just get some reassurance if possible that I'm not in for another learning experience in my near future.

    I have a master table that multiple users could be entering into at one time. Another user needed a quick and easy way to add multiple records at once. I created an append that will add those records to the master table, but am concerned the append may interfere in some way with the auto incrementing of the record numbers for the users entering one by one. Is there any way the auto increment could get messed up and cross users/records and cause problems?

    Thanks in advance for your assistance. I've been using this board for a couple of years now and have gained so much valuable info.

  • #2
    Re: Basic Append Question

    That is a sensible consideration, so good for you. I suppose the answer depends at least on how critical the app is and what other tables are updated simultaneously.
    If the answers are "not high" and no other updates occurring live - ie a simple single table data capture, I would trust that ALPHA'S record locking system (yes there is one in operation) is very adequate, since you are (apparently anyway) using standard A5 forms or browses with A5 append operation. This is after all its core business.
    I would recommend in any event you write a simple integrity checking program and have it run regularly as part of your diligence.
    Taking unnecessary programming steps within the operations could introduce unintended other errors.
    But don't lose focus on this issue as you expand, it must remain considered.
    Last edited by Ray in Capetown; 07-23-2015, 06:02 PM.

    Comment


    • #3
      Re: Basic Append Question

      Thank you very much for your assistance and reassurance. I'll continue to test this and keep an eye on it in the future, and I'm going to work on something to help me identify errors as you've recommended. So far, so good.

      Comment


      • #4
        Re: Basic Append Question

        Visit aimsdc.net and look for Auto Increment Function.
        There can be only one.

        Comment


        • #5
          Re: Basic Append Question

          Hi Stan. I found it and read that article. Not as complicated as it appears.
          I had prepared similar for invoicing, uses separate table containing last number, the last user id, status Busy/Complete and the reserved number.
          before a user can get the next number the status is checked for busy and puts up a "waiting for XYZ to finish Invoice number 123". while Checking for release.
          Always used that method in other databases.
          Interestingly enough no user has reported seeing this in normal high input circumstances... unless AND more importantly.. when a procedure failed to complete then not only does the "waiting" come up - no one can proceed but admin knows where to go to to assess the failure right away... thereby prevent the total disappearance of an invoice.
          The function for it is fairly simple. Building the handling around failure that is a little specific to situation.

          Comment


          • #6
            Re: Basic Append Question

            Thank you so much. This is exactly what I needed.

            Comment


            • #7
              Re: Basic Append Question

              If I understand Cal's approach, he uses a separate table for storing the counter value for each table that has an 'auto increment' field.

              I have a table called "counters" that has 60 fields, one for storing the last used counter value for each of 60 different tables with "roll-your-own-autoincremt" fields. My approach is basically the same as Cal's, but with only one counter table. With up to 20 concurrent users entering records, I have never had an issue. The open and change and save event happens so fast, given that it will try 4 times with a 1 second wait interval between each try, no users have ever gotten the error message telling them the table cannot be accessed - try again in a few seconds.
              Cole Custom Programming - Terrell, Texas
              972 524 8714
              [email protected]

              ____________________
              "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

              Comment


              • #8
                Re: Basic Append Question

                Hi Martin,
                I like the idea of one table. Could you give us an example of how you implement your script?
                Robin

                Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                Comment


                • #9
                  Re: Basic Append Question

                  Fun topic. I'll have to chime in. I use the same approach as Martin with one table that holds a record for each table that needs a unique id holding the next unique record id number (qid) which is retreived by my script qid_create() which accesses the qid table exclusively (with 5 trys @ .2 sec apart) and also creates the next increment number (if needed) not by autoincrement field rule. However, I have not 1 field for the value but 10 fields. Why? Because I also have a script qid_reuse( ) that is called when a record is deleted and that script captures the qid for the record being deleted and place into the next available (of the 10) fields of the qid record so I don't have major gaps in the qid numbers.
                  Mike W
                  __________________________
                  "I rebel in at least small things to express to the world that I have not completely surrendered"

                  Comment


                  • #10
                    Re: Basic Append Question

                    Hi Mike,
                    In my situation when the user adds a new Customer record for example, he creates a natural key and my script needs to create the primary key which he never sees. So I am trying to figure out which event to use to accomplish this using Martin's counter table. Any ideas?
                    Robin

                    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                    Comment


                    • #11
                      Re: Basic Append Question

                      In the CanWrite field rule event, I am trying to get a pointer to the field I want to update and am getting an error "no such field" for both tc.field_get(fname) where tc = table.current(); and also table.field_get(fname) where fname = "DIRCODE". Must I use the convention Directory->Dircode to use this in the FRUL event?

                      I noticed that this was how Cal defined his field pointer, but he didn't say where he was using his function.

                      Edit: Yes he did - the CanSaveRecord event - I will try it there instead...
                      Last edited by MoGrace; 07-26-2015, 02:09 PM.
                      Robin

                      Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                      Comment


                      • #12
                        Re: Basic Append Question

                        Mo, here is info regarding my approach. In the past maybe 17 years I have had only 2 failures - one with Alpha's autoincrement and one with my approach. I still don't like using Alpha's autoincrement fields, although my understanding is that they are much more reliable now than they were in 1998.

                        Code:
                        Actually, there are 81 fields, one for each of 81 tables.
                        Bear in mind that my approach began in 1999, way back with Version 5, 4.03. 
                        In those days, the word among developers was that autoincremt fields were not reliable.
                        Well, it happened to me on an important client, and it took me quite a while to fix the data.
                        And that's when I got the idea, as I recall from Peter Wayne, to make roll-your-own 
                        
                        autoincrements.
                        
                        This was an advantage for me since I archive tables to keep them as small as possible.  And I 
                        
                        let users search in the archives and reinstate records, using appends - which would cause the 
                        
                        autoincrment fields to change and mess up the data.
                        
                        If I were starting over, I would make the fields character instead of numeric. Below is a few 
                        
                        of the fields from a table called counters.
                        
                        Assett	Numeric	5	0	
                        Calaudit	Numeric	8	0	
                        Calequip	Numeric	5	0	
                        Calmaint	Numeric	8	0	
                        Charpyspec	Numeric	8	0	
                        Charpytestmeth	Numeric	8	0	
                        Chemspec	Numeric	8	0	
                        Client	Numeric	5	0	
                        Conductivity	Numeric	8	0	
                        Distributor	Numeric	5	0	
                        Equipcalpo	Numeric	6	0	
                        Fastenerspec	Numeric	8	0	
                        Fastmetal	Numeric	8	0	
                        Fixture	Numeric	9	0	
                        Generalvendor	Numeric	5	0	
                        Hardness	Numeric	8	0	
                        Hydrogenspec	Numeric	8	0	
                        Invoicenumber	Numeric	7	0	
                        Quotenumber	Numeric	7	0	
                        Labnum	Numeric	6	0	
                        Majaudit	Numeric	8	0	
                        Majequip	Numeric	5	0	
                        Majmaint	Numeric	8	0	
                        Manufacturer	Numeric	5	0	
                        Metal	Numeric	7	0	
                        Packingslip	Numeric	7	0	
                        Partkey	Numeric	6	0	
                        Payment	Numeric	7	0	
                        Penprocess	Numeric	9	0	
                        Pmatspeckey	Numeric	9	0	
                        Pprime	Numeric	9	0	
                        Saltspec	Numeric	9	0	
                        Tensilespec	Numeric	9	0	
                        Tensiletest	Numeric	8	0	
                        Tensiletesttestunique	Numeric	10	0	
                        Testid	Numeric	10	0	
                        Testingpo	Numeric	9	0	
                        Testmethod	Numeric	6	0	
                        Testplan	Numeric	8	0	
                        
                        Here is the "onenterecord" record event in field rules
                        
                        on error goto errors
                        t=table.get("clients")
                        t.client_id="TEMP"
                        end
                        errors:
                        err_msg = error_text_get(error_code_get())
                        line = error_line_number_get()
                        script = error_script_get()
                        ui_msg_box("error", err_msg+" error occurred at line "+alltrim(str(line,4,0))+ " in script: 
                        
                        "+script)     
                        end
                        
                        here is the "cansaverecord" event in field rules
                        
                        'Date Created: 07-May-2015 02:26:06 PM
                        'Last Updated: 07-May-2015 02:30:12 PM
                        'Created By  : MARTIN
                        'Updated By  : MARTIN
                        if a_deleting_record
                        	end
                        end if 
                        t=table.get("clients")
                        if t.mode_get()=1 'editing a record
                        	if t.baddress1=""
                        		t.baddress1=t.saddress1
                        		t.baddress2=t.saddress2
                        		t.bcity=t.scity
                        		t.bstate=t.sstate
                        		t.bzip=t.szip
                        		t.bzip2=t.szip2
                        	end if 
                        	end
                        end if 
                        if t.mode_get()=2 'entering a new record
                        	dim trys as n
                        	dim n as n
                        	dim temp as c
                        	trys=0
                        	on error goto retry
                        	t2=table.open("counters",FILE_RW_EXCLUSIVE)
                        	on error goto errors
                        	t2.change_begin()
                        		t2.client=t2.client + 1
                        	t2.change_end(.t.)
                        	n=t2.client
                        	t2.close()
                        	t=table.get("clients")
                        	temp=padl(alltrim(str(n)),5,"0")
                        	t.client_id=temp
                        	if t.baddress1=""
                        		t.baddress1=t.saddress1
                        		t.baddress2=t.saddress2
                        		t.bcity=t.scity
                        		t.bstate=t.sstate
                        		t.bzip=t.szip
                        		t.bzip2=t.szip2
                        	end if 
                        	end
                        end if 
                        end
                        retry:
                        if trys > 10
                        	cancel()	
                        	ui_msg_box("Error","The system is currently busy - try again in a minute!",16)
                        	sys_send_keys("{esc}")
                        	end
                        end if 
                        trys=trys + 1
                        sleep(1/3)
                        resume 0
                        end
                        errors:
                        err_msg = error_text_get(error_code_get())
                        line = error_line_number_get()
                        script = error_script_get()
                        ui_msg_box("Error", err_msg+" Error occurred at line "+alltrim(str(line,4,0))+ " in script: 
                        
                        "+script)
                        end
                        
                        here is a function that runs at night, and/or on administrator on-demand - that resets all the 
                        
                        counter fields
                        
                        'Date Created: 25-Aug-2009 08:41:59 AM
                        'Last Updated: 07-May-2015 02:33:51 PM
                        'Created By  : martin cole
                        'Updated By  : MARTIN
                        FUNCTION ResetCounters AS L ( )
                        	on error goto errors
                        	xbasic_wait_for_idle()
                        	t=table.open("counters",file_rw_exclusive)
                        	t.change_begin()
                        		if tablecount("testsmicrohi",".t.")=0
                        			t.microhardness=1			
                        		else
                        			t.microhardness=val(alltrim(left(tablemax("testsmicrohi",".t.","testid"),7))) 
                        		end if	
                        		t.testsbellexam=val(alltrim(left(tablemax("testsbell_welderexam",".t.","testid"),7))) 					
                        		t.testmagnetic=val(alltrim(left(tablemax("testsmagnetic",".t.","testid"),7))) 	
                        		t.flatwisespecs=val(alltrim(left(tablemax("flatwisespecs",".t.","specid"),8))) 
                        		t.Testsstressdurbspec=val(alltrim(left(tablemax("testsstressdurabspecs",".t.","specid"),8)))				
                        		t.testflatwise=val(alltrim(left(tablemax("testsflatwise",".t.","testid"),7))) 	
                        		t.batchno=tablemax("packingslips","batchno > 0","batchno")
                        		t.Hydembspec=val(alltrim(left(tablemax("hydembspecs",".t.","Hydembspecid"),9))) 
                        		n=val(alltrim(left(tablemax("testshydemb",".t.","testid"),7))) 	
                        		m=val(alltrim(left(tablemax("testshydemblog",".t.","testid"),7))) 		
                        		if m > n 
                        			t.testshydemb=m
                        		elseif n > m
                        			t.testshydemb=n 
                        		else
                        			t.testshydemb=n  
                        		end if 
                        		n=val(alltrim(left(tablemax("Testsstressdurb",".t.","testid"),7)))
                        		m=val(alltrim(left(tablemax("Testsstressdurblog",".t.","testid"),7)))
                        		if m > n 
                        			t.Testsstressdurblog=m
                        		elseif n > m
                        			t.Testsstressdurblog=n 
                        		else
                        			t.Testsstressdurblog=n  
                        		end if 
                        		t.Testsstressdurblog=val(alltrim(left(tablemax("Testsstressdurblog",".t.","testid"),7)))
                        		t.testshardcond=val(alltrim(left(tablemax("testshardcond",".t.","testid"),7))) 
                        		t.metaltestmethods=val(tablemax("metaltestmethods",".t.","testmethodid")) 	
                        		t.documentid=val(tablemax("documents",".t.","specid"))
                        		t.manualid=val(tablemax("docmanuals",".t.","manualid"))	
                        		n=val(tablemax("furnacespecs",".t.","specid"))
                        		m=val(tablemax("lotacceptance",".t.","specid"))		
                        		if m > n 
                        			t.Furnacespec=m
                        		elseif n > m
                        			t.Furnacespec=n 
                        		else
                        			t.Furnacespec=n  
                        		end if 		
                        		t.Furnacespec=val(tablemax("furnacespecs",".t.","specid"))
                        		t.testfastener=val(alltrim(left(tablemax("testsfastener",".t.","testid"),7))) 	
                        		t.tensiletest=val(alltrim(left(tablemax("teststensile",".t.","testid"),7)))
                        		t.testmetal=val(alltrim(left(tablemax("testsmetal",".t.","testid"),7))) 	
                        		t.testsmetal2=val(alltrim(left(tablemax("testsmetal2",".t.","testid"),7)))
                        		t.testslapshear=val(alltrim(left(tablemax("testslapshear",".t.","testid"),7)))	
                        		t.testsflexture=val(alltrim(left(tablemax("testsflexture",".t.","testid"),7)))	
                        		t.testcharpy=val(alltrim(left(tablemax("testscharpy",".t.","testid"),7))) 	
                        		t.planschem=val(alltrim(left(tablemax("planschem",".t.","testid"),7))) 		
                        		t.planstensile=val(alltrim(left(tablemax("planstensile",".t.","testid"),7))) 	
                        		n=val(alltrim(left(tablemax("testsfurnace",".t.","testid"),7))) 	
                        		m=val(alltrim(left(tablemax("testslotaccept",".t.","testid"),7))) 		
                        		if m > n 
                        			t.testfurnace=m
                        		elseif n > m
                        			t.testfurnace=n 
                        		else
                        			t.testfurnace=n  
                        		end if 
                        		t.testfurnace=val(alltrim(left(tablemax("testsfurnace",".t.","testid"),7))) 	
                        		n=val(alltrim(left(tablemax("testssaltspray",".t.","testid"),7))) 	
                        		m=val(alltrim(left(tablemax("testssaltlog",".t.","testid"),7))) 		
                        		if m > n 
                        			t.testsalt=m
                        		elseif n > m
                        			t.testsalt=n 
                        		else
                        			t.testsalt=n  
                        		end if 
                        		t.penspec=val(alltrim(tablemax("penspecs",".t.","penspecid"))) 
                        		n=val(alltrim(left(tablemax("testsfastmetal",".t.","testid"),7)))
                        		m=val(alltrim(left(tablemax("testsfastmetal_log",".t.","testid"),7)))
                        		if m > n 
                        			t.testfastmetal=m
                        		elseif n > m
                        			t.testfastmetal=n 
                        		else
                        			t.testfastmetal=n 
                        		end if 
                        		n=val(alltrim(left(tablemax("testspenetrant",".t.","testid"),7)))
                        		m=val(alltrim(left(tablemax("testspenetrant_log",".t.","testid"),7)))
                        		if m > n 
                        			t.testpen=m
                        		elseif n > m
                        			t.testpen=n 
                        		else
                        			t.testpen=n 
                        		end if 
                        		t.testhydrogen=val(alltrim(left(tablemax("testshydrogen",".t.","testid"),7))) 	
                        		t.testchem=val(alltrim(left(tablemax("testschem",".t.","testid"),7))) 		
                        		t.tensiletesttestunique=val(tablemax("teststensiletests",".t.","testuniqueid")) 
                        		t.testplan=val(tablemax("tplans",".t.","testplanid"))		
                        		t.vengenpo=val(tablemax("vengenpo",".t.","ponumber")) 		
                        		t.vendorauditunique=val(tablemax("vendoraudits",".t.","auditunique")) 		
                        		t.vendor=val(tablemax("vendors",".t.","vendorid")) 		
                        		t.testmethod=val(tablemax("testmethods",".t.","testmethodid")) 		
                        		t.testingpo=val(tablemax("testingpo",".t.","ponum")) 		
                        		t.tensilespec=val(tablemax("tensilespecs",".t.","tensilespecid"))
                        		t.saltspec=val(tablemax("saltspecs",".t.","saltspecid"))
                        		t.penprocess=val(tablemax("penprocess",".t.","Penetrantid"))
                        		t.payment=val(tablemax("payments",".t.","paymentnumber"))	
                        		t.partkey=val(alltrim(right(tablemax("partnumbers",".t.","Partkey"),7))) 	
                        		t.packingslip=val(tablemax("packingslips",".t.","Packingslipnumber"))
                        		t.metal=val(tablemax("metallographicspecs",".t.","specid"))
                        		t.manufacturer=val(tablemax("manufacturers",".t.","mnfid"))	
                        		t.majequip=val(tablemax("equipmentmajor",".t.","Majequipid"))	
                        		t.majmaint=val(tablemax("equipmajmaint",".t.","Majmaintunique"))	
                        		t.majaudit=val(tablemax("equipmajaudits",".t.","Majauditunique"))
                        		t.labnum=val(alltrim(right(tablemax("login",".t.","labnum"),6))) 
                        		t.invoicenumber=val(alltrim(right(tablemax("invoices",".t.","Invoicenumber"),7))) 
                        		t.quotenumber=val(alltrim(right(tablemax("quotes",".t.","Invoicenumber"),7))) 	
                        		t.assett=val(tablemax("otherassetts",".t.","assettsid"))
                        		t.calaudit=val(tablemax("equipmentcalaudits",".t.","calauditunique"))
                        		t.calequip=val(tablemax("equipmentcalibration",".t.","calequipid"))	
                        		t.calmaint=val(tablemax("equipcalmaint",".t.","calmaintunique"))
                        		t.charpyspec=val(tablemax("charpyspecs",".t.","charpyspecid"))			
                        		t.charpytestmeth=val(tablemax("charpytestmethods",".t.","charpymethodid"))	
                        		t.chemspec=val(tablemax("chemspecs",".t.","chemspecid"))
                        		n=val(tablemax("clients",".t.","client_id"))
                        		m=val(tablemax("clients_arch",".t.","client_id"))			
                        		dim z as n
                        		if m > n
                        			z=m
                        		else
                        			z=n 
                        		end if 
                        		t.client=z
                        		t.conductivity=val(tablemax("conductivityspecs",".t.","conductivityspecid"))	
                        		t.distributor=val(tablemax("distributors",".t.","dstid"))			
                        		t.equipcalpo=val(tablemax("equipcalpo",".t.","ponum"))				
                        		t.fixture=val(tablemax("fixturespecs",".t.","fixturespecid"))	
                        		t.fastenerspec=val(tablemax("fastenerspecs",".t.","fastenerspecid"))		
                        		t.fastmetal=val(tablemax("fastmetalspecs",".t.","fastmetalspecid"))		
                        		t.generalvendor=val(tablemax("vendorsgeneral",".t.","vendorid"))		
                        		t.hardness=val(tablemax("hardnessspecs",".t.","hardnessspecid"))
                        		t.hydrogenspec=val(tablemax("hydrogenspecs",".t.","Hydrogenspecid"))	
                        		t.testawsd171=val(alltrim(left(tablemax("testsaws_d171",".t.","testid"),7))) 	
                                	t.testawsd11=val(alltrim(left(tablemax("testsaws_d11",".t.","testid"),7))) 	
                        		t.printoptions=val(alltrim(tablemax("testsprintoptions",".t.","notesid"))) 	
                        		t.Masterpass=val(alltrim(tablemax("masterpass",".t.","uniqueid"))) 	
                        	t.change_end(.t.)
                        	t.close()
                        	resetcounters=.t.
                        	end
                        	errors:
                        	t.close()
                        	resetcounters=.f.
                        	msgbox("Note tell Martin","Error occurred in ResetCounters function")
                        	err_msg = error_text_get(error_code_get())
                        	line = error_line_number_get()
                        	script = error_script_get()
                        	ui_msg_box("Error", err_msg+" Error occurred at line "+alltrim(str(line,4,0))+ " in script: "+script)
                        	end
                        END FUNCTION
                        Hope this helps.
                        Last edited by martinwcole; 07-26-2015, 03:43 PM.
                        Cole Custom Programming - Terrell, Texas
                        972 524 8714
                        [email protected]

                        ____________________
                        "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                        Comment


                        • #13
                          Re: Basic Append Question

                          Thank you Martin, I will digest your script for my needs.

                          In the meantime I notice that if A_DELETING_RECORD is true, you just end the script which allows the record deletion to take place. Then in your reset section you get the actual last number from your tables.

                          My Question: How are you controlling a deletion that would create a skip in the series - or do you not do that? I am trying to allow a deletion only for the last record entered so if the user inadvertently enters a duplicate (with a spelling difference for example...), he can delete it, otherwise he cannot just arbitrarily go and delete older records. I am not having much luck with this idea at the moment, as I can't seem to stop the record deletion even though my prompt appears correctly when I test the field value.

                          My function returns T or F depending on whether a deletion should be allowed or not. In CanDeleteRecord, if the value returned is .f. then I have Cancel() as the condition. Tracing my script shows F was returned, yet the record deletes anyway.

                          Any ideas?
                          Last edited by MoGrace; 07-26-2015, 05:15 PM.
                          Robin

                          Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                          Comment


                          • #14
                            Re: Basic Append Question

                            well .... you could modify the script. It is not important to me that there is a missing number. Also. they can delete records, provided certain conditions are met. My reset always resets it to the table max, so if you only delete the last record, the reset would correctly reset it, as you describe.
                            Cole Custom Programming - Terrell, Texas
                            972 524 8714
                            [email protected]

                            ____________________
                            "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                            Comment


                            • #15
                              Re: Basic Append Question

                              I am still working on it, but using the tablemax() after a record deletion, inside the delete script, is not getting the correct value. Maybe tomorrow will bring clarity...
                              Robin

                              Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                              Comment

                              Working...
                              X