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

script stops at a certain point and i cant see why.

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

    script stops at a certain point and i cant see why.

    im sorry for posting this as the script is so long but ive come to a dead end and need a little help

    i have a very long script which duplicates a record in a parent table and all child records in child tables (.dbf)

    im having a couple of problems but the first is that the script gets to a certain point and then doesnt work any longer. i was hoping someone could see where i was going wrong.

    i know this is a long script but if somebody has some time to have a look through it and see if you can spot where i am going wrong, id really appreciate it, the script duplicates the records for tables upto tbl10 but not for tbl12 (there is no tbl11) so the chances are the problem is towards the end of the script.

    some lines are commented out, these are filters i am having problems (any help with these filters also greatly apreciated) with and plan on coming back to once i have the basic script working well.


    Code:
    function afterDialogValidate as v (e as p)
    	
    	'duplicate the selected case
    	'session.caseref is carried over from adv cust case list and used to filter all tables for duplication
    			
    	dim qry as P
    	dim nrecs as N
    	dim i as N
    	dim varMthDiff as N
    	dim varYrDiff as N
    
    	varMthDiff = e._state.mthcount
    	varYrDiff = e._state.yrcount
    	
    	filter_caseref = "caseref =" +quote(session.caseref)
    	
    
    	'duplicate the casefile table
    	dim tbl as P 
    	dim duptbl as P
    	tbl = table.open("[PathAlias.ADB_Path]\casefile.dbf")
    	duptbl = table.open("[PathAlias.ADB_Path]\casefile.dbf")
    	
    		query.description = "Dup Case"
    		query.order = ""
    		query.filter = filter_caseref
    		query.options = ""
    		qry = tbl.query_create()
    		nrecs = qry.records_get()
    	
    		if nrecs > 0
    		
    		tbl.fetch_first()
    		while .NOT. tbl.fetch_eof()
    			duptbl.enter_begin()
    			duptbl.case_parent_id = tbl.case_parent_id
    			duptbl.clienttitle = tbl.clienttitle
    			duptbl.clientfirstname = tbl.clientfirstname
    			duptbl.clientsurname = tbl.clientsurname
    			duptbl.adviser = tbl.adviser
    			duptbl.app_type2 = tbl.app_type2
    			duptbl.password = tbl.password
    			duptbl.source = tbl.source
    			duptbl.stage = "Lead"
    			duptbl.leaddate = Date()
    			duptbl.no_of_applicants = tbl.no_of_applicants
    			duptbl.branch = tbl.branch
    			duptbl.case_owner = session.employeename
    			duptbl.mortgagetype = tbl.mortgagetype
    			duptbl.clientanydependents = tbl.clientanydependents
    			duptbl.clientanyadverse = tbl.clientanyadverse
    			duptbl.clientanydebts = tbl.clientanydebts
    			duptbl.dpa_review = tbl.dpa_review
    			duptbl.dpa_newsletter = tbl.dpa_newsletter
    			duptbl.dpa_thirdparty = tbl.dpa_thirdparty
    			duptbl.clientdob = tbl.clientdob
    			duptbl.clientmaritalstatus = tbl.clientmaritalstatus
    			duptbl.clienttelhome = tbl.clienttelhome
    			duptbl.clienttel_work = tbl.clienttel_work
    			duptbl.clienttel_mobile = tbl.clienttel_mobile
    			duptbl.clientemail = tbl.clientemail
    			duptbl.clientpreferredcontact = tbl.clientpreferredcontact
    			duptbl.clientsmoke = tbl.clientsmoke
    			duptbl.clientnationality = tbl.clientnationality
    			duptbl.clientnationalitystate = tbl.clientnationalitystate
    			duptbl.middlename1 = tbl.middlename1
    			duptbl.secondmiddle1 = tbl.secondmiddle1
    			duptbl.maidenname1 = tbl.maidenname1
    			duptbl.birthplace1 = tbl.birthplace1
    			duptbl.natins1 = tbl.natins1
    			duptbl.filelocation = tbl.filelocation
    			duptbl.tracl_live = tbl.tracl_live	
    			duptbl.clienttitle2 = tbl.clienttitle2
    			duptbl.clientsurname2 = tbl.clientsurname2
    			duptbl.clientfirstname2 = tbl.clientfirstname2
    			duptbl.clientdob2 = tbl.clientdob2
    			duptbl.clientmaritalstatus2 = tbl.clientmaritalstatus2
    			duptbl.clienttelhome2 = tbl.clienttelhome2
    			duptbl.clienttel_work2 = tbl.clienttel_work2
    			duptbl.clienttel_mobile2 = tbl.clienttel_mobile2
    			duptbl.clientemail2 = tbl.clientemail2
    			duptbl.clientpreferredcontact2 = tbl.clientpreferredcontact2
    			duptbl.clientsmoke2 = tbl.clientsmoke2
    			duptbl.clientnationality2 = tbl.clientnationality2
    			duptbl.clientnationalitystate2 = tbl.clientnationalitystate2
    			duptbl.middlename2 = tbl.middlename2
    			duptbl.secondmiddle2 = tbl.secondmiddle2
    			duptbl.maidenname2 = tbl.maidenname2
    			duptbl.birthplace2 = tbl.birthplace2
    			duptbl.natins2 = tbl.natins2
    			duptbl.enter_end()		
    			tbl.fetch_next()
    		end while
    			dim NewCaseref as c
    			NewCaseref = duptbl.caseref
    		qry.close()
    		tbl.close()
    		duptbl.close()
    	end if
    	
    
    	
    	'duplicate dependents
    	dim tbl2 as p 
    	dim duptbl2 as P
    	tbl2 = table.open("[PathAlias.ADB_Path]\tdep.dbf")
    	duptbl2 = table.open("[PathAlias.ADB_Path]\tdep.dbf")
    		
    		query.description = "Dup dependents"
    		query.order = ""
    '		dim varDepUntil as N = tbl2.dependentageend
    '		dim varAgeNow as N = tbl2.dependentage
    '		
    '		e.control.depuntil = varDepUntil
    '		e.control.agenow = varAgeNow
    '		
    '		filter_dep =  Val(varDepUntil) > Val(varAgeNow)
    '		filter_recs ="("+filter_dep +") .and. ("+filter_caseref +")"
    		query.filter = filter_caseref
    		query.options = ""
    		qry = tbl2.query_create()
    		nrecs = qry.records_get()
    		
    		if nrecs > 0
    		
    		tbl2.fetch_first()
    		while .NOT. tbl2.fetch_eof()
    			duptbl2.enter_begin()
    			duptbl2.caseref = NewCaseref
    			duptbl2.dependenttype = tbl2.dependenttype
    			duptbl2.dependentname = tbl2.dependentname
    			duptbl2.dependentage = tbl2.dependentage + varyrDiff
    			duptbl2.dependentageend = tbl2.dependentageend
    			duptbl2.dependenton = tbl2.dependenton
    			duptbl2.enter_end()
    			tbl2.fetch_next()
    		end while
    
    		qry.close()
    		tbl2.close()
    		duptbl2.close()
    	end if
    	
    	'duplicate debts
    	dim tbl3 as p 
    	dim duptbl3 as P
    	tbl3 = table.open("[PathAlias.ADB_Path]\debts.dbf")
    	duptbl3 = table.open("[PathAlias.ADB_Path]\debts.dbf")
    	
    		query.description = "Dup debts"
    		query.order = ""
    '		filter_mthsleft = "commmonthsleft > "  + convert_type(varMthDiff, "c") 
    '		filter_recs ="("+filter_mthsleft +") .and. ("+filter_caseref +")"
    		query.filter = filter_caseref
    		query.options = ""
    		qry = tbl3.query_create()
    		nrecs = qry.records_get()
    		
    		if nrecs > 0
    		
    		tbl3.fetch_first()
    		while .NOT. tbl3.fetch_eof()
    			duptbl3.enter_begin()
    			duptbl3.caseref = NewCaseref
    			duptbl3.commtype = tbl3.commtype
    			duptbl3.commlender = tbl3.commlender
    			duptbl3.commbalance = tbl3.commbalance
    			duptbl3.commmonthly = tbl3.commmonthly
    			duptbl3.commmonthsleft = tbl3.commmonthsleft-varMthDiff
    			duptbl3.commsecured = tbl3.commsecured
    			duptbl3.commrepaid = tbl3.commrepaid
    			duptbl3.commwho = tbl3.commwho
    			duptbl3.commlimit = tbl3.commlimit
    			duptbl3.commbalancehow = tbl3.commbalancehow
    			duptbl3.commbalancehowstat = tbl3.commbalancehowstat
    			duptbl3.enter_end()
    				
    			tbl3.fetch_next()
    		end while
    
    		qry.close()
    		tbl3.close()
    		duptbl3.close()
    	end if
    	
    	'duplicate adverse credit history
    	dim tbl4 as p 
    	dim duptbl4 as P
    	tbl4 = table.open("[PathAlias.ADB_Path]\tadverse.dbf")
    	duptbl4 = table.open("[PathAlias.ADB_Path]\tadverse.dbf")
    
    		query.description = "Dup adverse"
    		query.order = ""
    		query.filter = filter_caseref 'no need to filter records - adviser can adjust if adverse is no longer applicable
    		query.options = ""
    		qry = tbl4.query_create()
    		nrecs = qry.records_get()
    		
    		if nrecs > 0
    
    		
    		tbl4.fetch_first()
    		while .NOT. tbl4.fetch_eof()
    		
    			duptbl4.enter_begin()
    			duptbl4.caseref = NewCaseref
    			duptbl4.adversetype = tbl4.adversetype
    			duptbl4.adversewho = tbl4.adversewho
    			duptbl4.adverseregistered = tbl4.adverseregistered
    			duptbl4.adversesatisfied = tbl4.adversesatisfied
    			duptbl4.adversesatisfiedmonths = tbl4.adversesatisfiedmonths
    			duptbl4.adversevalue = tbl4.adversevalue
    			duptbl4.adversereason = tbl4.adversereason	
    			duptbl4.enter_end()
    				
    			tbl4.fetch_next()
    		end while
    		qry.close()
    		tbl4.close()
    		duptbl4.close()
    	end if
    	
    	'duplicate address history
    '	dim tbl5 as P 
    '	dim duptbl5 as P
    '	query.description = "Dup addresses"
    '	query.order = ""
    '	query.filter = filter_caseref
    '	query.options = ""
    '	qry = tbl5.query_create()
    '	nrecs = qry.records_get()
    '		if varMortGrp = "Residential" .and. varMortType = "Purchase" then
    '			duptbl5 = table.open("[PathAlias.ADB_Path]\tclientres.dbf")
    '			duptbl5.enter_begin()
    '				duptbl5.caseref = NewCaseref
    '				duptbl5.client = tbl.clientfirstname
    '				duptbl5.clienthousenumber = tbl.newhousenumber
    '				duptbl5.clientaddress = tbl.newaddress
    '				duptbl5.clientlocality = tbl.newlocality
    '				duptbl5.clienttown = tbl.newtown
    '				duptbl5.clientpostcode = tbl.newpostcode
    '				duptbl5.clientmonthsaddress = varMthDiff
    '				duptbl5.clientyrsaddress = varYrDiff	
    '				duptbl5.enter_end()
    '				
    '				if tbl.no_of_applicants = "2" then
    '					duptbl5.enter_begin()
    '						duptbl5.caseref = NewCaseref
    '						duptbl5.client = tbl.clientfirstname2
    '						duptbl5.clienthousenumber = tbl.newhousenumber
    '						duptbl5.clientaddress = tbl.newaddress
    '						duptbl5.clientlocality = tbl.newlocality
    '						duptbl5.clienttown = tbl.newtown
    '						duptbl5.clientpostcode = tbl.newpostcode
    '						duptbl5.clientmonthsaddress = varMthDiff
    '						duptbl5.clientyrsaddress = varYrDiff	
    '					duptbl5.enter_end()
    '					duptbl5.close()
    '				end if
    '		end if
    '		if nrecs > 0 
    '			tbl5 = table.open("[PathAlias.ADB_Path]\tclientres.dbf")
    '			duptbl5 = table.open("[PathAlias.ADB_Path]\tclientres.dbf")	
    '				tbl5.fetch_first()
    '				while .NOT. tbl5.fetch_eof()			
    '					duptbl5.enter_begin()
    '					duptbl5.caseref = NewCaseref
    '					duptbl5.client = tbl5.client
    '					duptbl5.clienthousenumber = tbl5.clienthousenumber
    '					duptbl5.clientaddress = tbl5.clientaddress
    '					duptbl5.clientlocality = tbl5.clientlocality
    '					duptbl5.clienttown = tbl5.clienttown
    '					duptbl5.clientpostcode = tbl5.clientpostcode
    '					if tbl5.add_type = "Current" then
    '						duptbl5.clientmonthsaddress = tbl5.clientmonthsaddress + varYrsDiff 'need to add time since last case to months and years
    '						duptbl5.clientyrsaddress = tbl5.clientyrsaddress + varMthDiff
    '					else
    '						duptbl5.clientmonthsaddress = tbl5.clientmonthsaddress 'dont add time since to records that were not the clients current address
    '						duptbl5.clientyrsaddress = tbl5.clientyrsaddress	
    '					end if
    '					duptbl5.enter_end()	
    '					tbl5.fetch_next()
    '				end while
    '				qry.close()
    '				tbl5.close()
    '				duptbl5.close()
    '			end if
    
    
    	
    	'duplicate current mortgage / rent
    '	dim tbl6 as P 
    '	dim duptbl6 as P
    '	tbl6 = table.open("[PathAlias.ADB_Path]\tcurrmort.dbf")
    '	duptbl6 = table.open("[PathAlias.ADB_Path]\tcurrmort.dbf")
    '	query.description = "Dup curr mort"
    '	query.order = ""					
    '	filter_repay = "Currpropsold = .f. "	
    '	filter_recs ="("+filter_repay +") .and. ("+filter_caseref +")"
    '	query.filter = filter_recs
    '	query.options = ""
    '	qry = tbl6.query_create()
    '	nrecs = qry.records_get()	
    '		if varMortGrp = "Residential" .and. varMortType = "Purchase" then 'copy record from mortgage product sold on original case
    '			dim tbl_prodsummart as P
    '			dim tbl_prodmort as P
    '			tbl_prodsummary = table.open("[PathAlias.ADB_Path]\prod_summary.dbf")
    '			tbl_prodmort = table.open("[PathAlias.ADB_Path]\prod_mort.dbf")
    '				query.description = "Get Mort Prod"
    '				query.order = ""					
    '				filter_prodtype = "prod_grp = Mortgage "
    '				fileter_prodor = "prod_dateor > {} "
    '				filter_recs ="("+filter_prodtype +") .and. ("+filter_prodor +") .and.  ("+filter_caseref +")"
    '				query.filter = filter_recs
    '				query.options = ""
    '				qry = tbl_prodsummary.query_create()
    '				nrecs = qry.records_get()
    '			
    '				duptbl6.enter_begin()
    '				duptbl6.caseref = NewCaseref
    '					if tbl.no_of_applicants = "2" then
    '						duptbl6.currreswhose = alltrim(tbl.clientfirstname) + " " + alltrim(tbl.clientfirstname2)
    '					else
    '						duptbl6.currreswhose = alltrim(tbl.clientfirstname)
    '					end if
    '				duptbl6.residentialtype = "Mortgage"
    '				duptbl6.currmortlast3yrs = "No"
    '				duptbl6.currmorttype = tbl_prodmort.recrepaymethod
    '				duptbl6.curmortgagepay = tbl_prodsummary.prod_premium
    '				duptbl6.currmortstartmonth = varMthDiff
    '				duptbl6.currmortstartyear = varYrDiff
    '				duptbl6.currmortlender = tbl_prodsummary.prod_provider 
    '				duptbl6.currrepaytype = tbl_prodmort.recrepaymethod
    '				duptbl6.currmortoriginalterm = tbl_prodsummary.prod_type
    '				duptbl6.currpenalties = tbl_prodmort.chk_penalties
    '				duptbl6.currpenaltiespay = "No"
    '				duptbl6.currpropvalue = tbl_prodmort.recpropvalue
    '				duptbl6.currpropsold = .f. 
    '				duptbl6.currmortportable = tbl_prodmort.chkportability
    '				duptbl6.currmortrevert = tbl_prodmort.prod_payfuture
    '				duptbl6.currmortactno = tbl_prodsummary.prod_provref
    '				qry.close()
    '				duptbl6.enter_end()
    '				duptbl6.close()
    '				tbl_prodsummary.close()
    '				tbl_prodmort.close()
    '			end if
    '	if nrecs > 0	
    '			duptbl6 = table.open("[PathAlias.ADB_Path]\tcurrmort.dbf")
    '				'copy the rest of the records filters to those which were not going to be repaid in the original case
    '				tbl6.fetch_first()
    '				while .NOT. tbl6.fetch_eof()
    '					duptbl6.enter_begin()
    '					duptbl6.caseref = NewCaseref
    '					duptbl6.currreswhose = tbl6.currreswhose
    '					duptbl6.residentialtype = tbl6.residentialtype
    '					duptbl6.currrentpay = tbl6.currrentpay
    '					duptbl6.currmortlast3yrs = tbl6.currmortlast3yrs
    '					duptbl6.currmorttype = tbl6.currmorttype
    '					duptbl6.curmortgagepay = tbl6.curmortgagepay
    '					duptbl6.currmortbal = tbl6.currmortbal
    '					duptbl6.currmortstartmonth = tbl6.currmortstartmonth + varMthDiff
    '					duptbl6.currmortstartyear = tbl6.currmortstartyear + varYrDiff
    '					duptbl6.currmortlender= tbl6.currmortlender
    '					duptbl6.currrepaytype = tbl6.currrepaytype
    '					duptbl6.currmortrepvalue = tbl6.currmortrepvalue
    '					duptbl6.currmortiovalue = tbl6.currmortiovalue
    '					duptbl6.currmortoriginalterm = tbl6.currmortoriginalterm
    '					duptbl6.currpenalties = tbl6.currpenalties
    '					duptbl6.currpenaltiesvalue = tbl6.currpenaltiesvalue
    '					duptbl6.currpenaltiespay = tbl6.currpenaltiespay
    '					duptbl6.currpropvalue = tbl6.currpropvalue
    '					duptbl6.currpropsold = tbl6.currpropsold 
    '					duptbl6.currmortportable = tbl6.currmortportable
    '					duptbl6.currmortpensend = tbl6.currmortpensend
    '					duptbl6.currmortrevert = tbl6.currmortrevert
    '					duptbl6.currmortactno = tbl6.currmortactno
    '					duptbl6.other_payment = tbl6.other_payment
    '					duptbl6.l_houseno = tbl6.l_houseno
    '					duptbl6.l_street = tbl6.l_street
    '					duptbl6.l_town = tbl6.l_town
    '					duptbl6.l_postcode = tbl6.l_postcode
    '					duptbl6.enter_end()	
    '				tbl6.fetch_next()
    '				end while
    '				qry.close()
    '				tbl6.close()
    '				duptbl6.close()
    '		end if
    	
    	'duplicate the budget planner
    	dim tbl7 as P 
    	dim duptbl7 as P
    	tbl7 = table.open("[PathAlias.ADB_Path]\budget.dbf")
    	duptbl7 = table.open("[PathAlias.ADB_Path]\budget.dbf")
    	
    		query.description = "Dup budget planner"
    		query.order = ""
    		query.filter = filter_caseref
    		query.options = ""
    		qry = tbl7.query_create()
    		nrecs = qry.records_get()
    		
    		if nrecs > 0
    		
    		tbl7.fetch_first()
    		while .NOT. tbl7.fetch_eof()
    		
    			duptbl7.enter_begin()
    			duptbl7.caseref = NewCaseref
    			duptbl7.curr_mortrent = tbl7.curr_mortrent
    			duptbl7.curr_ctax = tbl7.curr_ctax
    			duptbl7.curr_water = tbl7.curr_water
    			duptbl7.curr_tv = tbl7.curr_tv
    			duptbl7.curr_internet = tbl7.curr_internet
    			duptbl7.curr_foodliving = tbl7.curr_foodliving
    			duptbl7.curr_travel = tbl7.curr_travel
    			duptbl7.curr_homeins = tbl7.curr_homeins
    			duptbl7.curr_lifeins = tbl7.curr_lifeins
    			duptbl7.curr_otherins = tbl7.curr_otherins
    			duptbl7.curr_savings = tbl7.curr_savings
    			duptbl7.curr_carservice = tbl7.curr_carservice
    			duptbl7.curr_childminding = tbl7.curr_childminding
    			duptbl7.currother = tbl7.currother
    			duptbl7.enter_end()
    				
    			tbl7.fetch_next()
    		end while
    
    		qry.close()
    		tbl7.close()
    		duptbl7.close()
    	end if
    		
    	'duplicate employment records
    '	dim tbl8 as P
    '	dim duptbl8 as P
    '	tbl8 = table.open("[PathAlias.ADB_Path]\tclientjobs.dbf")
    '	duptbl8 = table.open("[PathAlias.ADB_Path]\tclientjobs.dbf")
    '	
    '		query.description = "Dup client jobs"
    '		query.order = ""
    '		query.filter = filter_caseref
    '		query.options = ""
    '		qry = tbl8.query_create()
    '		nrecs = qry.records_get()
    '		
    '		if nrecs > 0
    '		
    '		tbl8.fetch_first()
    '		while .NOT. tbl8.fetch_eof()
    '		
    '			duptbl8.enter_begin()
    '			duptbl8.caseref = NewCaseref
    '			duptbl8.client = tbl8.client
    '			duptbl8.employoccupation = tbl8.employoccupation
    '			duptbl8.employemployer = tbl8.employemployer
    '			duptbl8.employprobation = tbl8.employprobation
    '			duptbl8.employprobationtime = tbl8.employprobationtime
    '			duptbl8.employtype = tbl8.employtype
    '			duptbl8.employbasic = tbl8.employbasic
    '			duptbl8.employeegot = tbl8.employeegot
    '			duptbl8.employeerot = tbl8.employeerot
    '			duptbl8.employeerentalincome = tbl8.employeerentalincome
    '			duptbl8.employeercomm = tbl8.employeercomm
    '			duptbl8.employeegbonus = tbl8.employeegbonus
    '			duptbl8.employeerbonus = tbl8.employeerbonus
    '			duptbl8.employotherincome = tbl8.employotherincome
    '			duptbl8.employotherincomesource = tbl8.employotherincomesource
    '			duptbl8.employselfcert = "No"
    '			duptbl8.employeeretirementage = tbl8.employeeretirementage
    '			duptbl8.employeenetincome = tbl8.employeenetincome
    '			duptbl8.employeechanges = tbl8.employeechanges
    '			duptbl8.employeechangetype = tbl8.employeechangetype
    '			duptbl8.employeechangereason = tbl8.employeechangereason
    '			duptbl8.selfgrossincome = tbl8.selfgrossincome
    '			duptbl8.selfnoofaccts = tbl8.selfnoofaccts
    '			duptbl8.selfnetprofitcurrent = tbl8.selfnetprofitcurrent
    '			duptbl8.selfnetprofitlast = tbl8.selfnetprofitlast
    '			duptbl8.selfnetprofitprevious = tbl8.selfnetprofitprevious
    '			duptbl8.selfcompanytype = tbl8.selfcompanytype
    '			duptbl8.selfshareholding = tbl8.selfshareholding
    '			duptbl8.selfaccountantname = tbl8.selfaccountantname
    '			duptbl8.selfaccountanttel = tbl8.selfaccountanttel
    '			duptbl8.employbasis = tbl8.employbasic
    '
    '				duptbl8.employstartdate = tbl8.employstartdate 'dont add add time if job was not current.
    '				duptbl8.employstartmonths = tbl8.employstartmonths
    '	
    '			duptbl8.job_type = tbl8.job_type
    '			duptbl8.income_type = tbl8.income_type	
    '			duptbl8.enter_end()
    '				
    '			tbl8.fetch_next()
    '		end while
    '	
    '		qry.close()
    '		tbl8.close()
    '		duptbl8.close()
    '	end if
    	
    	'duplicate the IDD
    	dim tbl9 as P 
    	dim duptbl9 as P
    	tbl9 = table.open("[PathAlias.ADB_Path]\idd.dbf")
    	duptbl9 = table.open("[PathAlias.ADB_Path]\idd.dbf")
    	
    		query.description = "Dup idd"
    		query.order = ""
    		query.filter = filter_caseref
    		query.options = ""
    		qry = tbl9.query_create()
    		nrecs = qry.records_get()
    		
    		if nrecs > 0
    		
    		tbl9.fetch_first()
    		while .NOT. tbl9.fetch_eof()
    		
    			duptbl9.enter_begin()
    			duptbl9.caseref = NewCaseref
    			duptbl9.case_parent_id = tbl9.case_parent_id
    			duptbl9.iddmort = tbl9.iddmort
    			duptbl9.iddmortbasis = tbl9.iddmortbasis
    			duptbl9.iddmortbasiswom = tbl9.iddmortbasiswom
    			duptbl9.iddmortbasislp = tbl9.iddmortbasislp
    			duptbl9.iddmortbasissp = tbl9.iddmortbasissp
    			duptbl9.iddlifetime = tbl9.iddlifetime
    			duptbl9.iddlifetimebasis = tbl9.iddlifetimebasis
    			duptbl9.iddbtl = tbl9.iddbtl
    			duptbl9.iddpureprotection = tbl9.iddpureprotection
    			duptbl9.iddpureprotectionbasis = tbl9.iddpureprotectionbasis
    			duptbl9.iddprotbasiswom = tbl9.iddprotbasiswom
    			duptbl9.iddprotbasislp = tbl9.iddprotbasislp
    			duptbl9.iddprotbasissp = tbl9.iddprotbasissp
    			duptbl9.iddhomeins = tbl9.iddhomeins
    			duptbl9.iddhomeinsbasis = tbl9.iddhomeinsbasis
    			duptbl9.iddasu = tbl9.iddasu
    			duptbl9.iddasubasis = tbl9.iddasubasis
    			duptbl9.iddissued = tbl9.iddissued
    			duptbl9.iddissuedate = tbl9.iddissuedate
    			duptbl9.iddappttype = tbl9.iddappttype
    			duptbl9.iddappttypestate = tbl9.iddappttypestate
    			duptbl9.iddfeebasisno = tbl9.iddfeebasisno
    			duptbl9.iddfeebasis2 = tbl9.iddfeebasis2
    			duptbl9.iddfee2amt = tbl9.iddfee2amt
    			duptbl9.iddfeebasis3 = tbl9.iddfeebasis3
    			duptbl9.iddfee3amt = tbl9.iddfee3amt
    			duptbl9.iddconfirmissued = tbl9.iddconfirmissued
    			duptbl9.iddmortadvised = tbl9.iddmortadvised
    			duptbl9.iddmortadviceyes = tbl9.iddmortadviceyes
    			duptbl9.iddmortadvoceno = tbl9.iddmortadvoceno
    			duptbl9.iddinsadvised = tbl9.iddinsadvised
    			duptbl9.iddinsadvisedyes = tbl9.iddinsadvisedyes
    			duptbl9.iddinsadvisedyes = tbl9.iddinsadvisedno
    			duptbl9.iddfeerefund = tbl9.iddfeerefund
    			duptbl9.iddfeerefundyes = tbl9.iddfeerefundyes
    			duptbl9.iddfeerefundno = tbl9.iddfeerefundno
    			duptbl9.iddbtlonlytobattach = tbl9.iddbtlonlytobattach
    			duptbl9.compiddissueddate = Date()
    			duptbl9.iddhomebasis_fa = tbl9.iddhomebasis_fa
    			duptbl9.iddhomebasis_lp = tbl9.iddhomebasis_lp
    			duptbl9.iddhomebasis_sp = tbl9.iddhomebasis_sp
    			duptbl9.enter_end()
    				
    			tbl9.fetch_next()
    		end while
    		qry.close()
    		tbl9.close()
    		duptbl9.close()
    	end if
    	
    
    	
    	'duplicate mortgage questionnaire
    	dim tbl10 as P 
    	dim duptbl10 as P
    	tbl10 = table.open("[PathAlias.ADB_Path]\tmortquestionnaire.dbf")
    	duptbl10 = table.open("[PathAlias.ADB_Path]\tmortquestionnaire.dbf")
    	
    		query.description = "Dup MortQ"
    		query.order = ""
    		query.filter = filter_caseref
    		query.options = ""
    		qry = tbl10.query_create()
    		nrecs = qry.records_get()
    		
    		if nrecs > 0
    		
    		tbl10.fetch_first()
    		while .NOT. tbl10.fetch_eof()
    		
    			duptbl10.enter_begin()
    				duptbl10.caseref = NewCaseref
    				duptbl10.mqexplainmethods = tbl10.mqexplainmethods
    				duptbl10.mqcertainty = tbl10.mqcertainty
    				duptbl10.mqpreparedinvestment = tbl10.mqpreparedinvestment
    				duptbl10.mqclientunderstand = tbl10.mqclientunderstand
    				duptbl10.discfixed = tbl10.discfixed
    				duptbl10.disccapped = tbl10.disccapped
    				duptbl10.disctracker = tbl10.disctracker
    				duptbl10.discdisc = tbl10.discdisc
    				duptbl10.discvar = tbl10.discvar
    				duptbl10.disclibor = tbl10.disclibor
    			duptbl10.enter_end()	
    			tbl10.fetch_next()
    		end while
    		qry.close()
    		tbl10.close()
    		duptbll0.close()
    	end if
    	
     
    	
    	'duplicate existing policies
    	dim tbl12 as P 
    	dim duptbl12 as P
    	tbl12 = table.open("[PathAlias.ADB_Path]\texispols.dbf")
    	duptbl12 = table.open("[PathAlias.ADB_Path]\texispols.dbf")
    	
    		query.description = "Dup ExisPols"
    		query.order = ""
    		query.filter = filter_caseref
    		query.options = ""
    		qry = tbl12.query_create()
    		nrecs = qry.records_get()
    		
    		if nrecs > 0
    		
    		tbl12.fetch_first()
    		while .NOT. tbl12.fetch_eof()		
    			duptbl12.enter_begin()
    				duptbl12.caseref = NewCaseref
    				duptbl12.policytype = tbl12.policytype
    				duptbl12.provider = tbl12.provider
    				duptbl12.sumassured = tbl12.sumassured
    				duptbl12.premium = tbl12.premium
    				duptbl12.termleft = tbl12.termleft 
    				duptbl12.currentpurpose = tbl12.currentpurpose
    				duptbl12.futurepurpose = tbl12.futurepurpose
    				duptbl12.policyno = tbl12.policyno
    				duptbl12.client = tbl12.client
    			duptbl12.enter_end()	
    			tbl12.fetch_next()
    		end while
    		qry.close()
    		tbl12.close()
    		duptbll2.close()
            end if
    
    	' go to IDD page of new case
    
    
    
    end function

    #2
    Re: script stops at a certain point and i cant see why.

    Place a debug(1) above tbl12.fetch_first() and use working preview. You can then see what nrecs contains as I suspect it is failing at the query
    Creating Healthcare Work-Flow Solutions Since 2005

    Comment


      #3
      Re: script stops at a certain point and i cant see why.

      thanks Omar,

      stupid mistake i had made, i wasnt closing the previous table, tbll0 instead of tbl10 (letter 'l' instead of number '1').

      Comment


        #4
        Re: script stops at a certain point and i cant see why.

        Originally posted by richard2007 View Post
        thanks Omar,

        stupid mistake i had made, i wasnt closing the previous table, tbll0 instead of tbl10 (letter 'l' instead of number '1').
        Never stupid!! Sometimes you just need to do what you just did and that is to take a step back.
        Have a great day and glad you found the issue!
        Creating Healthcare Work-Flow Solutions Since 2005

        Comment

        Working...
        X