DEFAULT TABLE([Schedule]) TRACE $day1:=[Schedule]FIRSTO $day2:=[Schedule]Segundo $day3:=[Schedule]tercero $day4:=[Schedule]quarto $day5:=[Schedule]LASTO $subrecNo:=Records in subselection([Schedule]Slot1) ALL SUBRECORDS([Schedule]Slot1) FIRST SUBRECORD([Schedule]Slot1) For ($x;1;$subrecNo) $nombre:=[Schedule]Slot1'Monday  `monday $number:=[Schedule]Slot1'M_Id $time:=[Schedule]Slot1'Time1 $date:=$day1 If ($nombre#"") & ($number="") ALERT("encontre") ALL RECORDS([Appointments]) QUERY([Appointments];[Appointments]datee=$date;*) QUERY([Appointments]; & ;[Appointments]Time=$time) If (Records in selection([Appointments])=0)   `look for appointment for that date and time and name   `if does not exist, create record CREATE RECORD([Appointments]) [Appointments]datee:=$date [Appointments]Name:=$nombre [Appointments]Time:=$time SAVE RECORD([Appointments]) End if End if   `------------------------------------------------------------ $nombre2:=[Schedule]Slot1'Tuesday  `tuesday $number2:=[Schedule]Slot1'T_Id $time:=[Schedule]Slot1'Time1 $date:=$day2 If ($nombre2#"") & ($number2="") ALERT("encontre") CREATE RECORD([Appointments]) [Appointments]datee:=$date [Appointments]Name:=$nombre2 [Appointments]Time:=$time SAVE RECORD([Appointments]) End if   `------------------------------------------------------ $nombre3:=[Schedule]Slot1'Wednesday  `wed $number3:=[Schedule]Slot1'W_Id $time:=[Schedule]Slot1'Time1 $date:=$day3 If ($nombre3#"") & ($number3="") ALERT("encontre") CREATE RECORD([Appointments]) [Appointments]datee:=$date [Appointments]Name:=$nombre3 [Appointments]Time:=$time SAVE RECORD([Appointments]) End if $nombre4:=[Schedule]Slot1'Thursday  `thursday $number4:=[Schedule]Slot1'Th_Id $time:=[Schedule]Slot1'Time1 $date:=$day4 If ($nombre4#"") & ($number4="") ALERT("encontre") CREATE RECORD([Appointments]) [Appointments]datee:=$date [Appointments]Name:=$nombre4 [Appointments]Time:=$time SAVE RECORD([Appointments]) End if $nombre5:=[Schedule]Slot1'Friday  `friday $number5:=[Schedule]Slot1'Fr_Id $time:=[Schedule]Slot1'Time1 $date:=$day5 If ($nombre5#"") & ($number5="") CREATE RECORD([Appointments]) [Appointments]datee:=$date [Appointments]Name:=$nombre5 [Appointments]Time:=$time SAVE RECORD([Appointments]) End if NEXT SUBRECORD([Schedule]Slot1) End for