Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need some help with a appointment calender 2

Status
Not open for further replies.

TonCoronel

Programmer
Dec 1, 2003
37
NL
I have to build a calender where all the appointments of the employees can be seen, for the company I am working for.

Can Someone give me some usefull tips on how to build such a thning? or does someone maybe have a link to some good information ore has ready to go source:D
 
Oke I got that part now but I have a very dificult question now.

The index is just a number of a schedule in the calender. so lets say there are 5 different appointments on the calender. If i save them I have to convert the ID to strings (I dont know why but else I cant retrieve them) so the five appointments are called. 1a,2a,3a,4a,5a. When I delete for instance number 3 and close the application. The database will look as followed. 1a,2a,4a,5a. When I add a new appointment the next time the index of this appointment will be number 5 because there are only 4 items on the calender. So if i save this new appointment again the database looks like: 1a,2a,4a,5a,5a!. what can I do about this? I want to be able to select the ID from the database and I want to be able to use an identity column that I also can use as an index for the calender.
 
The index number in the schedule control was never intended to be used to generate unique identity-type IDs for each schedule item. As you point out, it is only a sequence number for the schedule items currently in the schedule control. You will need to write your own routine to generate unique IDs for the schedule item records in your database.

Once you have done that, the Name property on each schedule item lets you store the database ID with each schedule item and can be used to find schedule item by your database ID. The Name property happens to be a string type property, which is why you may have to convert you database ID to a string, but you can still use it as follows:

When you add an existing schedule record to the schedule control:
// Assuming "schedule_id" is the field containing your database ID and it is numeric -
ls_key = String(ids_schedule.GetItemNumber(ll_row, "schedule_id") )
ldt_start = ids_schedule.GetItemDateTime(ll_row, "start_dt")
ll_length = <length of appointment in minutes>
ls_display = <description to display on the schedule item>
// The following are optional depending on whether you want to show resources
// or categories in the schedule.
ls_resource = ""
ls_category = ""
// Add the schedule item.
ole_schedule.Object.ScheduleItems.Add(ls_key, ldt_start, ls_resource, ldt_start, ll_length, ls_display, ls_category)

To add your database ID to a newly created schedule item:
// Where loo_item is the OLEObject containing the new schedule item
// and ll_id is your new database ID:
loo_item.Name = String(ll_id)

To find a schedule item using your database ID:
OLEObject loo_item
String ls_key
// Where ll_id is your database ID
ls_key = String(ll_id)
loo_item = ole_schedule.Object.ScheduleItems.Item(ls_key)

To get your database ID from a known schedule item:
String ls_key
Long ll_id
ls_key = loo_item.Name
ll_id = Long(ls_key)

To get your database ID from a schedule control index number:
String ls_key
Long ll_id
// Where li_index is the schedule control index number
ls_key = ole_schedule.Object.ScheduleItems[li_index].Name
ll_id = Long(ls_key)

For more details look for the ScheduleItems Name property and the Item( ) method for ScheduleItems in the GravityBox help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top