Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving Multiple Values Into One Record of a Table
Message
From
19/12/2007 23:06:04
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Saving Multiple Values Into One Record of a Table
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01276751
Message ID:
01276751
Views:
71
I create a cursor that has the rows/values below. Hours, Minutes (intervals) and then the days of the week (logicals). The user is basically creating an appointment type rule and these are the options that will be presented on the form. They can check any logical to block out time for whatever reason. If they want to block out each Wednesday from 9am to 12pm, then they just click on the appropriate checkboxes in the intervals for Monday. Choosing the FromDate and ToDate sets the start and end dates for the rule.

My current issue is how to save their choices into one record of another table. That table is what will be used to actually go out and block out the times in our scheduling program. The record in that table contains a key field, AppointmentTypeCode, DOW, the start and end times for the block, and also the FromDate and ToDate values for the rule.

I think there is a basic flaw, or at least a challange, that on this entry form, the user can enter multiple blocks of time, on various days. This means that there would be multiple records in the other table. I'm not sure how to handle that. I think it will mean selecting from the cursor below for any days/times that have a logical checked and then creating as many records/rules as there are days. I think...

Any thoughts or questions welcome. Thanks!
       Hour    Minutes   SMTWTFS

          8          0   FFFFFFF
          8         15   FFFFFFF
          8         30   FFFFFFF
          8         45   FFFFFFF
          9          0   FFFFFFF
          9         15   FFFFFFF
          9         30   FFFFFFF
          9         45   FFFFFFF
         10          0   FFFFFFF
         10         15   FFFFFFF
         10         30   FFFFFFF
         10         45   FFFFFFF
          .          .   .......
          .          .   .......
          .          .   .......
          6          0   FFFFFFF
          6         15   FFFFFFF
          6         30   FFFFFFF
          6         45   FFFFFFF
          7          0   FFFFFFF
          7         15   FFFFFFF
          7         30   FFFFFFF
          7         45   FFFFFFF
Code that creates the cursor:
CLOSE ALL
CLEAR 

CREATE CURSOR WeeklyPickList (;
	HOUR I, ;
	MINUTE I, ;
	SUNDAY L, ;
	MONDAY L, ;
	TUESDAY L, ;
	WEDNESDAY L, ;
	THURSDAY L, ;
	FRIDAY L, ;
	SATURDAY L)

SELECT WeeklyPickList

m.Interval = 15 && This will be populated from MB_Office (or something)
m.StartingHour = 8 && This will be populated from MB_Office (or something)

m.TimeSlotsPerHour = (1440/m.Interval)/24 && 1,440 is the number of minutes in 24 hours

FOR iHour = m.StartingHour TO 24 + (m.StartingHour -1)
	APPEND BLANK
	REPLACE WeeklyPickList.Hour WITH IIF(iHour>24,iHour-24,iHour)
	REPLACE WeeklyPickList.Minute WITH 0
	FOR iMinutes = 1 TO m.TimeSlotsPerHour -1
		APPEND BLANK
		REPLACE WeeklyPickList.Hour WITH IIF(iHour>24,iHour-24,iHour)
		REPLACE WeeklyPickList.Minute WITH iMinutes * m.Interval
	ENDFOR
ENDFOR

BROWSE LAST 
Next
Reply
Map
View

Click here to load this message in the networking platform