Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Scan not working properly
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Scan not working properly
Divers
Thread ID:
00772993
Message ID:
00772993
Vues:
36
My "SCAN" command only loops through once even though I have about eleven records. Can my "LOCATE FOR" command be throwing my scan off. Here is the code:
WITH thisform
LOCAL x,rec

SELECT lv_x_emp_itc
SCAN 

	rec = lv_x_emp_itc.id
	DO CASE 
	
		CASE lv_x_emp_itc.upd_status == 'A' 	&& add
			SELECT rv_itcrecordcount.lastrecordid FROM rv_itcrecordcount INTO array a__gen1
	        If vartype(a__gen1) != 'U' or vartype(a__gen1) != 'L' 

				x = a__gen1(1,1)
				RELEASE a__gen1 
				x = x + 1
				UPDATE rv_itcrecordcount set rv_itcrecordcount.lastrecordid = (x)
				TABLEUPDATE(.t.,.t.,'rv_itcrecordcount')				
				INSERT into rv_udfields (ssno, firstname, middle , lastname, dateappoint, ;
					division, unit, position, dob, eyes, ht, wt, department, ;
					issuedate, extrahelp, pmt, archive, idnumber) VALUES ( ;
				ALLTRIM(lv_x_emp_itc.ssno), ;
				....
				....
				ALLTRIM(lv_x_emp_itc.archive), ;
				(x))
				TABLEUPDATE(.t.,.t.,'rv_udfields')				
			ELSE 
				INSERT into lv_hld_from_arc_access (h_ssno, h_firstname, ;
					h_mid, h_lastname, h_dateappoint, h_division, ;
					h_unit, h_position, h_dob, h_eyes, h_ht, h_wt, ;
					h_department, h_issuedate, h_extrahelp, h_pmt, ;
					h_archive, h_upd_status, h_other_id, h_datetime, h_from_screen) ;
					 VALUES ( ;
				ALLTRIM(lv_x_emp_itc.ssno), ;
				....
				....
				lv_x_emp_itc.w_datetime)
				TABLEUPDATE(.t.,.t.,'hld_from_arc_access')
			ENDIF 
			DELETE from lv_x_emp_itc WHERE lv_x_emp_itc.id = rec
			TABLEUPDATE(.t.,.t.,'lv_x_emp_itc')
		
		CASE lv_x_emp_itc.upd_status == 'C'		&& change
			SELECT rv_udfields
			LOCATE FOR ALLTRIM(rv_udfields.ssno) == ALLTRIM(lv_x_emp_itc.ssno)
			IF FOUND()
				UPDATE rv_udfields SET ;
				....
				....
				rv_udfields.archive = ALLTRIM(lv_x_emp_itc.archive)
				TABLEUPDATE(.t.,.t.,'rv_udfields')				
			ELSE
				INSERT into lv_hld_from_arc_access ( h_ssno, h_firstname, ;
					h_mid, h_lastname, h_dateappoint, h_division, ;
				....
				....
				TABLEUPDATE(.t.,.t.,'hld_from_arc_access')				
			ENDIF 
			DELETE from lv_x_emp_itc WHERE lv_x_emp_itc.id = rec				
			TABLEUPDATE(.t.,.t.,'lv_x_emp_Itc')
				 
		CASE lv_x_emp_itc.upd_status == 'D' 	&& delete			
			SELECT rv_udfields
			LOCATE FOR ALLTRIM(rv_udfields.ssno) == ALLTRIM(lv_x_emp_itc.ssno)
			IF FOUND()
				DELETE from rv_udfields WHERE ALLTRIM(rv_udfields.ssno) == ALLTRIM(lv_x_emp_itc.ssno)
				TABLEUPDATE(.t.,.t.,'rv_udfields')				
			ELSE 
				INSERT into lv_hld_from_arc_access ( h_ssno, h_upd_status, h_other_id, h_datetime, ;
					h_from_screen) VALUES ( ALLTRIM(lv_x_emp_itc.ssno), ALLTRIM(lv_x_emp_itc.upd_status), ;
				lv_x_emp_itc.id, lv_x_emp_itc.w_datetime)
				TABLEUPDATE(.t.,.t.,'hld_from_arc_access')
			ENDIF 			
			DELETE from lv_x_emp_itc WHERE lv_x_emp_itc.id = rec				
			TABLEUPDATE(.t.,.t.,'lv_x_emp_itc')
	ENDCASE 
ENDSCAN 
ENDWITH
Thanks
Nick Patel
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform