Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Eliminate Unwanted Records in Script

0 views
Skip to first unread message

senriz

unread,
Nov 9, 2009, 2:59:26 PM11/9/09
to
I'm a novice using FMP 9. I have a layout called Forms, of which I
have duplicated as Locked Forms and set all the field behaviors to
unmodifiable. The main Forms layout has a checkbox to lock the form
when completed. I created a script that produces a list for a selected
student and displays whether the form is locked or not. I then created
another script, attached it as a button on the list, that allows you
to select the form you want and display it in the main Forms layout or
the Locked Forms layout based on the Locked Checkbox. This script does
take me to the correct layout with the correct form... but the problem
is if a student has an unlocked Form and a Lock Form they both will
show up in the found set. Hence, if I click to go to a Locked Form, on
there I can click next record and the unlocked form shows up in the
Locked Form layout and the same for unlocked Forms too, it will show a
locked form. I've tried using the Constrain Found Set in my script,
but I get "No records found" error. Below is my script. I
would appreciate any insight into how I can eliminate the unwanted
records. Thanks.

If [ ValueCount (IEP::LockCkBx) = 1 ]
Go to Layout [ “Locked IEP Forms” (IEP) ]
Enter Browse Mode
Adjust Window
[ Resize to Fit ]
Else
Go to Layout [ “IEP Forms” (IEP) ]
Enter Browse Mode
Adjust Window
[ Resize to Fit ]
End If

105

unread,
Nov 9, 2009, 7:46:19 PM11/9/09
to
senriz wrote:
> I'm a novice using FMP 9. I have a layout called Forms, of which I
> have duplicated as Locked Forms and set all the field behaviors to
> unmodifiable. The main Forms layout has a checkbox to lock the form
> when completed. I created a script that produces a list for a selected
> student and displays whether the form is locked or not.

small point of terminology, you are locking the record, not the form,
the form is only the layout you are using to display the record data


I then created
> another script, attached it as a button on the list, that allows you
> to select the form you want and display it in the main Forms layout or
> the Locked Forms layout based on the Locked Checkbox. This script does
> take me to the correct layout with the correct form...

So a simple conditional
If status = locked, go locked layout
else go un-locked layout
you have this working


but the problem
> is if a student has an unlocked Form and a Lock Form they both will
> show up in the found set. Hence, if I click to go to a Locked Form, on
> there I can click next record and the unlocked form shows up in the
> Locked Form layout and the same for unlocked Forms too, it will show a
> locked form.


So you are stepping through the records while on the form layout(s) with
a found set comprising of both locked and un-locked records

It sounds like you are allowing the user to step through records using
the status area.
If so, lock out the status are, and put some step nav buttons on the
layout like in the FM templates << < > >>
that waty you can attach a script to these to evaluate the record status
for each record, and go to appropriate layout


go record next
If status = locked
go layout locked
else
go layout unlocked

If you were using FM10 you could usea layout trigger to evaluate teh
status on record load


I have much the same scenario in a prescription database (still in FM9)
wher some pescriptions are authority ype some are not, and there are
different layouts for each type
The same step script can be used on all layouts, with a simple
conditional test for the layout name to trigger the conditional layout
change e.g.


Navigation: nav - step records
#list layouts are ADMISSION
If [ Get ( ScriptParameter ) = "first" ]
Go to Record/Request/Page
[ First ]
Else If [ Get ( ScriptParameter ) = "previous" ]
Go to Record/Request/Page
[ Previous ]
Else If [ Get ( ScriptParameter ) = "next" ]
Go to Record/Request/Page
[ Next ]
Else If [ Get ( ScriptParameter ) = "last" ]
Go to Record/Request/Page
[ Last ]
End If
#
#For Prescription FORM layouts only
If [ Case(
Get ( LayoutName ) = "Prescriptions - Form O" ; 1;
Get ( LayoutName ) = "Prescriptions - Form A" ; 1;
) ]
If [ Prescriptions::Type_OA|Rx = "A" ]
Go to Layout [ “Prescriptions - form A” (Prescriptions) ]
Else If [ Prescriptions::Type_OA|Rx = "O" ]
Go to Layout [ “Prescriptions - form O” (Prescriptions) ]
End If
End If


I've tried using the Constrain Found Set in my script,
> but I get "No records found" error. Below is my script. I
> would appreciate any insight into how I can eliminate the unwanted
> records. Thanks.
>
> If [ ValueCount (IEP::LockCkBx) = 1 ]
> Go to Layout [ “Locked IEP Forms” (IEP) ]
> Enter Browse Mode
> Adjust Window
> [ Resize to Fit ]
> Else
> Go to Layout [ “IEP Forms” (IEP) ]
> Enter Browse Mode
> Adjust Window
> [ Resize to Fit ]
> End If


you can move the adjust, resize out of the conditional :

> If [ ValueCount (IEP::LockCkBx) = 1 ]
> Go to Layout [ “Locked IEP Forms” (IEP) ]

> Else
> Go to Layout [ “IEP Forms” (IEP) ]

> End If
> Enter Browse Mode ( optional)

senriz

unread,
Nov 10, 2009, 1:17:13 PM11/10/09
to

My understanding is limited with scripting. This is so helpful.
Thank you very much!!

senriz

unread,
Nov 11, 2009, 3:22:15 PM11/11/09
to
> Thank you very much!!- Hide quoted text -
>
> - Show quoted text -

I actually ended up putting in the navigation arrows, removing the
status bar and configuring the script with "If status = 1, go to
Locked Forms" because I needed other links/scripts to work on the
layout. It all works so perfect, and the look and feel is very
professional. Thank you again. I just have one problem... the scroll
button on my mouse enables a user to view only an "Unlocked Form" in
the "Locked Form" Layout. Do you know is there any way to stop that
from happening?

105

unread,
Nov 12, 2009, 5:01:42 PM11/12/09
to

>> - Show quoted text -
>
> I actually ended up putting in the navigation arrows, removing the
> status bar and configuring the script with "If status = 1, go to
> Locked Forms" because I needed other links/scripts to work on the
> layout. It all works so perfect, and the look and feel is very
> professional. Thank you again. I just have one problem... the scroll
> button on my mouse enables a user to view only an "Unlocked Form" in
> the "Locked Form" Layout. Do you know is there any way to stop that
> from happening?


my scroll does not cause this so; a guess, try locking the status area
(there was a post in another thread on something similar)

This would be a situation where FM10 script trigger attached to the
layout would be useful (onrecordload, onlayoutload)

0 new messages