Updating Portal Records

I am new to Servoy. I have a solution which presents data in a calendar format using a series of portals based on the clientid plus the date. I wrote a method to move the date from one day to another. The method works well and changes the entry date but the calendar does not refresh the porals. I am obviously missing something. see code below:

In the calendar file (Schedules) I capture the index number of the initial entry. The user is then taken to a global date field to select a new date:

globals.gselected_schedentry_index = schedules_to_schedule_entrys_mon1.schedule_entrysid;
elements.gschedule_move_date.visible = true;
elements.gschedule_move_date.requestFocus();

Upon data change the following method runs:

schedules_to_schedule_entrys_mon1.setSelectedIndex(globals.gselected_schedentry_index);
schedules_to_schedule_entrys_mon1.shift_date = globals.gschedule_calendar_move_date;

I then tried each and all of the following:

forms.schedule_entrys.controller.saveData();
forms.schedule_entrys.controller.loadRecords();
forms.schedule_entrys.elements.shift_date.requestFocus();
elements.gschedule_move_date.visible = false;
forms.schedule_entrys.controller.show();
controller.show();

On screeen the Calendar viewer still shows the date in the portal before the change. I expected it to immediately display the entry in the new portal.

Any help would be appreciated.

Thanks.

Carmen

Carmen,

This should work fine. How is your relation defined?

Bob,

I think I figured out the problem based on your comment.

I used an unstored calculation in the Schedule file

var date = new Date(Mon_Week1_date);
return patientid + ‘/’ + date.toLocaleString();

related to a Text field (lookup_clientid_shiftdate) in the Schedule Entry file. This field did a lookup on RecordSelection from an unstored calculation (clientid_shiftdate)

var date = new Date(shift_date);
return client_id + ‘/’ + date.toLocaleString();

At the time I did not understand how to set up a stored calculation and the unstored calculation did not show up in the relations window as a foreign key option so I created what I thought was a work around.

The relation works to add and delete an entry and to change the date. It just doesn’t update the Schedules screen when the date is changed. I’m guessing that based on my structure, that the data is not being updated until I physically go to the record, at which time it does a RecordSelection event, makes the change and updates the screen.

I assume that I should make the relation in Schedule Entries a stored Calculation and relate directly to that. Correct?

Carmen

BINGO! :D