Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange situation - no error and not all code run
Message
 
 
To
04/02/2014 17:10:02
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01593215
Message ID:
01593218
Views:
32
This is exactly my point - I am trying to trace in the Debugger. As soon as I hit this line
case b_sched.pref_lvl11 = 3  && true
	   =MESSAGEBOX(b_sched.base_id)
	   =MESSAGEBOX( seek(b_sched.base_id, 'csrTemp1', 'base_id'))
	    
	    if not seek(b_sched.base_id, 'csrTemp1', 'base_id')
			lcReqOK = 'Booking requiring specific instructor base would be violated'
        endif
the cursor immediately goes to the endcase line. Why it doesn't even attempt to get me my messageboxes I added out of the desperation?

I don't think the coverage will provide any more insights here. I even started to wonder if I understand how case works in VFP. I have a condition which is true. Why no code inside the case statement is executed?

>>Hi everybody,
>>
>>I have a form with an ActiveX control. The form's base class has an Error method defined and I've seen it firing.
>>
>>One of the ActiveX control event is calling several form's methods (one method is calling another method).
>>
>>One method is called CheckInstructorPreferences and it starts with the following code
>>
>>
>>text TO lcSQL TEXTMERGE noshow
>>       DECLARE @Instr_ID CHAR(12);
>>       SET @Instr_ID = <<VFP2SQL(m.tcInstructor)>>;
>>       
>>        SELECT instr_id, sex, tch_level, snb_level, tele_level, misc_level,
>>          criteria_2, criteria_3, criteria_4, criteria_5, on_job, experience,
>>          pop_up1_1, pop_up1_2, pop_up1_3, pop_up1_4, pop_up1_5, pop_up1_6,
>>          pop_up1_7, pop_up1_8, pop_up1_9, pop_up1_10, pop_up2_1, pop_up2_2,
>>          pop_up2_3, pop_up2_4, pop_up2_5, pop_up2_6, pop_up2_7, pop_up2_8,
>>          pop_up2_9, pop_up2_10, pop_up2_11, pop_up2_12, pop_up2_13, pop_up2_14,
>>          pop_up2_15, pop_up3_1, pop_up3_2,
>>          pop_up3_3, pop_up3_4, pop_up3_5, pop_up3_6, pop_up3_7, pop_up3_8,
>>          pop_up3_9, pop_up3_10, pop_up3_11, pop_up3_12, pop_up3_13, pop_up3_14,
>>          pop_up3_15
>>     FROM dbo.b_instr
>>     WHERE instr_id= @Instr_ID <<m.lcSupervisorFilter>>;
>>     
>>     SELECT * from dbo.b_in_bs WHERE instr_id=@Instr_ID;
>>
>>ENDTEXT
>>
>>mysqlexec(m.lcSQL, 'csrTemp', program())
>>
>>select csrTemp1
>>index on base_id tag base_id
>>select csrTemp
>>&&STEP 1 - would this new booking conflict with guest requirements?
>>if alltrim(csrTemp.instr_id)==m.tcInstructor      &&found instructor?
>>	do case
>>	case b_sched.pref_lvl2=3 and not csrTemp.sex=b_sched.sex
>>		lcReqOK = 'Booking requiring a specific gender would be violated'
>>	case b_sched.pref_lvl4=3
>>		if !empty(b_sched.whichlevel)
>>			lcWhichLevel = lower(alltrim(b_sched.whichlevel))
>>			do case
>>			case m.lcWhichLevel = 'tch_level' and not csrTemp.tch_level>=b_sched.tch_level
>>				lcReqOK = 'Booking requiring a minimum alpine level would be violated'
>>			case m.lcWhichLevel = 'snb_level' and not csrTemp.snb_level>=b_sched.snb_level
>>				lcReqOK = 'Booking requiring a minimum snowboard level would be violated'
>>			case m.lcWhichLevel = 'tele_level' and not csrTemp.tele_level>=b_sched.tele_level
>>				lcReqOK = 'Booking requiring a minimum telemark level would be violated'
>>			case m.lcWhichLevel = 'misc_level' and not csrTemp.misc_level>=b_sched.misc_level
>>				lcReqOK = 'Booking requiring a minimum other level would be violated'
>>			endcase
>>		endif
>>	case b_sched.pref_lvl11 = 3 
>>	    if not seek(b_sched.base_id, 'csrTemp1', 'base_id')
>>			lcReqOK = 'Booking requiring specific instructor base would be violated'
>>        endif
>>	case b_sched.pref_lvl5=3 and not csrTemp.criteria_2=b_sched.criteria2
>>		lcReqOK='Booking requiring specific "' + alltrim(prefs_bk.b_crit2) + '" selection would be violated'
>>
>>I added today an extra select statement in the lcSQL and the extra case for checking base_id.
>>
>>So, when I try to debug this method once I go to the case b_sched.pref_lvl11 = 3 the cursor immediately goes to the endcase at the bottom and exits that method and then the rest of the code in the calling method fires.
>>
>>It looks to me that something is wrong on that seek line, but I do not see it. Also, the error method of the form is not firing.
>>
>>So, what could it be here?
>>
>>Why I can not go to the if not seek line?
>>
>>Also, originally the not seek was the same case condition, but I got similar behavior - once the cursor reached that line, it went to the end of the case statement.
>>
>>Do you see what I may be missing here?
>
>Trace in the debugger or use SET COVERAGE.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform