HELP!! I've been struggling with this all day. Just can't get it right.
The following script is called by another button that sets the variables, the FOR..NEXT does not repeat.
See anything obvious.. i hope
-----------------------
tp = table.open("Staff_Sch_temp") ' delete and stay open
tbl = table.open("Staff_Sch_shift")
query.description = "Schedule"
query.order = "Sch_Date"
query.filter = "Between(Sch_date,var->v_BeginDate,var->v_EndDate)"
query.options = ""
tbl.query_create()
tbl.fetch_first()
For i = 1 to vNo
WHILE .not. tbl.fetch_eof()
IF tbl.d1_staff ""
tp.enter_begin()
tp.shift1 = tbl.shift
tp.Sch_Date = vBegin 'tbl.Sch_Date
tp.staff = tbl.d1_staff
tp.enter_end()
END IF
IF tbl.d2_staff ""
tp.enter_begin()
tp.shift1 = tbl.shift
tp.Sch_date = vBegin+1 'tbl.Sch_Date+1
tp.staff = tbl.d2_staff
tp.enter_end()
END IF
IF tbl.d3_staff ""
tp.enter_begin()
tp.shift1 = tbl.shift
tp.Sch_Date = vBegin+2 'tbl.Sch_Date+2
tp.staff = tbl.d3_staff
tp.enter_end()
END IF
IF tbl.d4_staff ""
tp.enter_begin()
tp.shift1 = tbl.shift
tp.Sch_date = vBegin+3 'tbl.Sch_Date+3
tp.staff = tbl.d4_staff
tp.enter_end()
END IF
IF tbl.d5_staff ""
tp.enter_begin()
tp.shift1 = tbl.shift
tp.Sch_Date = vBegin+4 'tbl.Sch_Date+4
tp.staff = tbl.d5_staff
tp.enter_end()
END IF
IF tbl.d6_staff ""
tp.enter_begin()
tp.shift1 = tbl.shift
tp.Sch_date = vBegin+5 'tbl.Sch_Date+5
tp.staff = tbl.d6_staff
tp.enter_end()
END IF
IF tbl.d7_staff ""
tp.enter_begin()
tp.shift1 = tbl.shift
tp.Sch_Date = vBegin+6 'tbl.Sch_Date+6
tp.staff = tbl.d7_staff
tp.enter_end()
END IF
tbl.fetch_next()
END WHILE
vBegin = vBegin+7
ui_msg_box("","Completed "+alltrim(str(i))+" "+dtoc(vBegin))
Next
query.order = ""
query.filter = ""
query.options = ""
tbl.query_detach_all()
tbl.close()
tp.close()
-----------------
What do you see.
Thanks a bunch
Tom
The following script is called by another button that sets the variables, the FOR..NEXT does not repeat.
See anything obvious.. i hope
-----------------------
tp = table.open("Staff_Sch_temp") ' delete and stay open
tbl = table.open("Staff_Sch_shift")
query.description = "Schedule"
query.order = "Sch_Date"
query.filter = "Between(Sch_date,var->v_BeginDate,var->v_EndDate)"
query.options = ""
tbl.query_create()
tbl.fetch_first()
For i = 1 to vNo
WHILE .not. tbl.fetch_eof()
IF tbl.d1_staff ""
tp.enter_begin()
tp.shift1 = tbl.shift
tp.Sch_Date = vBegin 'tbl.Sch_Date
tp.staff = tbl.d1_staff
tp.enter_end()
END IF
IF tbl.d2_staff ""
tp.enter_begin()
tp.shift1 = tbl.shift
tp.Sch_date = vBegin+1 'tbl.Sch_Date+1
tp.staff = tbl.d2_staff
tp.enter_end()
END IF
IF tbl.d3_staff ""
tp.enter_begin()
tp.shift1 = tbl.shift
tp.Sch_Date = vBegin+2 'tbl.Sch_Date+2
tp.staff = tbl.d3_staff
tp.enter_end()
END IF
IF tbl.d4_staff ""
tp.enter_begin()
tp.shift1 = tbl.shift
tp.Sch_date = vBegin+3 'tbl.Sch_Date+3
tp.staff = tbl.d4_staff
tp.enter_end()
END IF
IF tbl.d5_staff ""
tp.enter_begin()
tp.shift1 = tbl.shift
tp.Sch_Date = vBegin+4 'tbl.Sch_Date+4
tp.staff = tbl.d5_staff
tp.enter_end()
END IF
IF tbl.d6_staff ""
tp.enter_begin()
tp.shift1 = tbl.shift
tp.Sch_date = vBegin+5 'tbl.Sch_Date+5
tp.staff = tbl.d6_staff
tp.enter_end()
END IF
IF tbl.d7_staff ""
tp.enter_begin()
tp.shift1 = tbl.shift
tp.Sch_Date = vBegin+6 'tbl.Sch_Date+6
tp.staff = tbl.d7_staff
tp.enter_end()
END IF
tbl.fetch_next()
END WHILE
vBegin = vBegin+7
ui_msg_box("","Completed "+alltrim(str(i))+" "+dtoc(vBegin))
Next
query.order = ""
query.filter = ""
query.options = ""
tbl.query_detach_all()
tbl.close()
tp.close()
-----------------
What do you see.
Thanks a bunch
Tom
Comment