dbTalk Databases Forums  

Eliminate Unwanted Records in Script

comp.databases.filemaker comp.databases.filemaker


Discuss Eliminate Unwanted Records in Script in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
senriz
 
Posts: n/a

Default Eliminate Unwanted Records in Script - 11-09-2009 , 01:59 PM






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

Reply With Quote
  #2  
Old   
105
 
Posts: n/a

Default Re: Eliminate Unwanted Records in Script - 11-09-2009 , 06:46 PM






senriz wrote:
Quote:
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
Quote:
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
Quote:
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,
Quote:
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 :

Quote:
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)
Adjust Window
[ Resize to Fit ]

Reply With Quote
  #3  
Old   
senriz
 
Posts: n/a

Default Re: Eliminate Unwanted Records in Script - 11-10-2009 , 12:17 PM



On Nov 9, 4:46*pm, 105 <corti... (AT) internode (DOT) on.net> wrote:
Quote:
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)
*> Adjust Window
*> [ Resize to Fit ]
My understanding is limited with scripting. This is so helpful.
Thank you very much!!

Reply With Quote
  #4  
Old   
senriz
 
Posts: n/a

Default Re: Eliminate Unwanted Records in Script - 11-11-2009 , 02:22 PM



On Nov 10, 10:17*am, senriz <dbsen... (AT) gmail (DOT) com> wrote:
Quote:
On Nov 9, 4:46*pm, 105 <corti... (AT) internode (DOT) on.net> wrote:





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)
*> Adjust Window
*> [ Resize to Fit ]

My understanding is limited with scripting. *This is so helpful.
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?

Reply With Quote
  #5  
Old   
105
 
Posts: n/a

Default Re: Eliminate Unwanted Records in Script - 11-12-2009 , 04:01 PM



Quote:
- 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)

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.