trouble with script meant to perform two tasks

Support for our integrated Contact Manager, Calendar, and Project Tracker.
Posts: 116
Joined: Mon Sep 04, 2006 1:19 pm
PostPosted: Sun Nov 12, 2006 7:32 pm
Hi again John:

Thanks again for your ongoing help with this. Now I have a portal to CalDailyApptRx's on one of the tabs in my MiniWindow Edit Appt layout. I have inserted a "modify" button that, when clicked, executes a script that I want to do the following:

1) duplicate the selected Rx record
2) set the StopDate of the selected Rx record to today (in other words, stopping this Rx)
3) go to the newly created Rx record and set its StartDate to today (in other words, initiating this new Rx as of today)
4) insert the cursor in the "Dose" field (because I am now going to change the dose of the Rx)

Here's the script I wrote. Needless to say -- it doesn't work(!)
--
Code: Select all
Set Variable [ $ContactID; Value:CalDailyAppointments::ApptContactID_kf ]
Set Variable [ $ApptDate; Value:CalDailyAppointments::ApptDateStart_k ]
Set Variable [ $ApptID; Value:CalDailyAppointments::ApptID_kprime ]
Set Variable [ $RxNumID; Value:CalDailyContactRx's::RxIDNumber_kf ]
Perform Script [ “Set field depending on tab selected, and Continue Script by Jim 09-16-06” ]
#Insert if statements here, if desired, to trap potential errors or problems (e.g. entering new Rx into an appointment greater than 10 days old).
Go to Related Record [ From table: “CalDailyContactRx's”; Using layout: “Patient Rx's” (ContactRx's) ]
[ Show only related records ]
View As
[ View as Form ]
Set Field [ CalDailyContactRx's::RxStopDate; Get ( CurrentDate ) ]
Duplicate Record/Request
Set Field [ CalDailyExContactRx's::RxStartDate; Get ( CurrentDate ) ]
Clear [ CalDailyContactRx's::RxStopDate ]
[ Select ]
Go to Field [ CalDailyContactRx's::RxDose ]
Pause/Resume Script [ Indefinitely ]
Go to Layout [ original layout ]
Perform Script [ “Go to tab corresponding to appointment type” ]
#Go to the 1st portal row.
Go to Portal Row [ Select; First ]

--

Can you help me figure out where I went wrong?

Yours,
Jim R.
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Mon Nov 13, 2006 7:01 am
Hi Jim,

The key here is going to the related record. Providing that is using the correct relationship then the basics of the script look good. Just remember that you don't need to set variables like this when you're duping a record, just when you're making new ones.

I'd also set the end date to "" instead of clearing it, since a field has to be on the layout for Clear to work.

Aside form that this looks OK so I'd need to know "how" its not working. Is the new version of the RX not being created, is it duping the wrong record, etc.?

Best,

John
John Sindelar
SeedCode
Posts: 116
Joined: Mon Sep 04, 2006 1:19 pm
PostPosted: Mon Nov 13, 2006 12:47 pm
Hi John:

Thanks for the feedback.

When I run this script:

1) it goes to (and duplicates) the wrong record; and
2) it sets the both the stop date and the start date of the same (incorrect) record to today's date.

Hope this helps!
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Tue Nov 14, 2006 8:24 am
If its going to the wrong record you'll want to check out your Go to Related Record script step: you may be using the wrong relationship.
John Sindelar
SeedCode
Posts: 116
Joined: Mon Sep 04, 2006 1:19 pm
PostPosted: Tue Nov 14, 2006 8:40 am
Thanks John. I'm not sure whether I have the correct relationship:

1) the portal is to CalDailyContactRx's
2) CalDailyContactRx's is a TO of ContactRx's
3) the script step reads as follows:

Code: Select all
 Go to Related Record [ From table: “CalDailyContactRx's”; Using layout: “Patient Rx's” (ContactRx's) ]


Does this look correct to you?
--
Jim R.
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Tue Nov 14, 2006 9:22 am
It does, but if the script is modifying the wrong record then something is up. I probably wouldn't be able to diagnose this without seeing the file. Feel free to email this to me and I'll take a look.
John Sindelar
SeedCode
Posts: 116
Joined: Mon Sep 04, 2006 1:19 pm
PostPosted: Tue Nov 14, 2006 4:48 pm
With your assistance, I finally got it to work, John. Thanks again!

Return to SeedCode Calendar

Who is online

Users browsing this forum: No registered users and 3 guests

(855) SEEDCODE
[email protected]
Follow us: