×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Check Box with a script behind it

Check Box with a script behind it

Check Box with a script behind it

(OP)
I was working on a database and wondered if i can make a field that will have one check box, what i want this to determine is
that if this box is check i want this record to be omitted if it is not checked then do not omit the record.

The purpose of this check box is to allow the user to select the records that they want to view so what i will have is a script to omit the selected records and then show only the omitted records (as JEANW had suggested).  

So the question is: How can i tie the check box to a script so i can get a flow of control to check "if checked select record if not do not select record.                

RE: Check Box with a script behind it

Your post is exactly the script:

Let the user check the records.
Then your script can be something along these lines:

Enter Find Mode
Set Field (yourTable::yourCheckboxField;yourCheckValue)
Perform Find
# This will find all the checked records.
If you want the user to 'see' the found set, put here some redirection for no records, 1 records, to a view/list layout etc.
Not really necessary because you check at least one record, it's just a good habit....
If ou want the user to see the 'not checked records' take the show omitted script step.

You can make a loop script to clear the checkbox after the find.

It depends how your structure is to have the 'point' where to clear the checkboxfields again, so they'll be ready for the next search.

RE: Check Box with a script behind it

(OP)
im still a little confused on how filemaker will be notified to omit a record that is "checked".  I can write the script that omits the records but im still unsure of how to let filemaker know that the records with the check selected are the ones that i want to omit so it view the checked records.

Basically i need to link the check mark to filemaker as a signal that this is  a record i need to omit.  

How do i make this possible

RE: Check Box with a script behind it

There are 2 ways to find records.

Or you do a search to find records with specific data.
This will give you a found set of records with the specific data.

Or you do a search for data that you know is not in the records you want to find.
FM will omit all the records without the data.

If you ask now to show the omitted records, FM will give you a found set of omitted records, the records without the asked data....

In your case.
Make a search for the checked records, FM will give you a found set with records where that field is checked.

If you want the records without the checked field, do the same search (the one for the checked field), but ask for the omitted records, FM will give you the found set of records without the checked records.

Bottom line:
1) you check records, search for checked records = found set with checked records.
2) you check records, search for (checked field empty) = records without checked field.
3) you check records, search for checked records and omit those = found set without checked records
4) you check records, search for checked records and omit those and ask to show omit records = found set with checked records.

Best way to understand the mechanics is to make a little file with 5 records and make several scripts with combinations of yes/no omit.
Follow your logic as to find records and see if FM follows your logic.

RE: Check Box with a script behind it

(OP)
What i mean is what kind of field should the box that signifies if a record is being selected or not selected be
should it be a calculation.  
I figured out how to isolate records taht the user may want to isolate, im just trying to figure out how will a checkbox
noftify filemaker that thats a record that i want to isolate.

RE: Check Box with a script behind it

The kind of field is not important, ít's the data in it.
You can make a 'special' Exclude field linked to a Yes/No valuelist with No or Yes as default value and make it radiobutton.
This will toggle between yes/no, if the label for that field is 'Omit ?'

Or just a Yes valuelist withthe field formatted as checkbox, checked will be 'Yes', not checked will be nothing (empty).

Or you could use a text field with default value 'Include criteria in result'. With a script you could toggle between this value and 'Remove criteria from result'.

FM will look for specific data that you, the developer linked to omit or not.

You can link those fields to a script that is triggered with a button on your search screen.
Something along these lines (for the last example)

#Make sure to check taht the mode is Find before taking this action.
If(Get(WindowMode)=1
# An omitted request will exclude the specified criteria from the search results
Omit Record
#Because usng the Omit Record step is a toggle for the Omit checkbox you need to toggle the feedback in the in the Exclude field. It will show the user whether the data is being included or excluded.
Set Field (yourExcludeField;
Case( yourExcludeField ="Include criteria in results";
"Exclude criteria from results"; "Include criteria in results"
)
End If

Basically, a well designed Search Routine has 8 scripts, 4 buttons and 2 layouts.
This together will give you a nearly waterproof searchsystem.

RE: Check Box with a script behind it

(OP)
On this topic again, sorry for my ignorance, but
if i were to use the check box option how would i link it to the script, for example i would have a field labeled:
Select Record For Editing (with a checkbox option next to it),
does filemaker return 1's or 0's such that a check in the box would = 1 for its value, and a blank check box be 0 for its value.

This way for the script i can go through all the records doing this in code:

//pseudo code
for (i= firstRecord; i < totalNumRecords; i++) {
    if(checkbox(record[i]) == checked) {
        omit(record[i]);
    }
}

show ommitted records;

/*esentiall the methods omit and show ommitted records dont
exists i would actually have to make a seperate array
but this way you get the idea
*/
//end pseudo code

i am having trouble applying this algorithm in scriptmaker for filemaker pro 8.

right now i see something like
Loop
(some method selecting the current record)
if(current records checkbox is checked)
   omit record
end if
(an increment that will switch to next record)
Exit Loop If (next record > total number of records)

im having trouble filing in the pseudo code

RE: Check Box with a script behind it

If you use a checkbox formatted field,
Checkbox Set will display value list items as checkboxes. Users can select multiple values for a field.

It is a 'format' of a field, the values in the field (if there are more than 1) will be as a return delimited list.

So if you use just 1 value (select for editing will be or yes or no) will give a value or no value, depend on the value(s) you put in the valuelist linked to the checkbox.

Searching for this value is basically not searching for a 'checked value', but for a value in the field.

So, if editing = 1, you make a search script, something along these lines:

Go to layout(your layout)
Enter find Mode ()
Set field, your field (checkboxfield) 1
Perform find
Go to layout (your layout)

Here you dont't need a 'special search' layout, it's all scripted for 1 single purpose.

Because the not checked records will have no values you make the same script with 1 additional step to find the not '1' records.

Just add
Show omitted only after the perform find step to find the records.

RE: Check Box with a script behind it

(OP)
Ok i think i get how you link it.

So my field is named select record for editing.
and in the value list of the check box set i made it "edit this record".

So would the if statement look like

if(select record for editing = edit this record)
   omit record
end if




i would have a loop going through all the records
to see which ones have the valule "edit this record" if it was checked.
(i am having trouble writing the script where you loop through all records, i cant seem to get passed the second record, is there like a count or some variable taht i can keep track of for an if statement so the loop will look like
Loop
If(on first record)
  go to record(first);
end if
If(select for editing = edit this record)
   omit record
end if
go to record(next)
exit loop if(get(record number) > get (total number records);

im not sure if this is the correct way to do it.


then i would run a script after that going into another layout then find mode which will then only show the omitted records.

thank you

RE: Check Box with a script behind it

(OP)
im seriously confused with the script;

i think i may be doing something wrong with the way you suggested it.

i made a dummy database to try the algorithm and it looks like this.

i have a field that is just a number which i can keep track of the record im on.

then a text field that is labeled select for editing with the filed format as a checkbox field.

the checkbox field's value list only has one value that is
Edit this record.

from this i wrote the script

Go to layout(my layout)
Enter Find Mode ()
Set Field[Untitled:: select for editing = "Edit this record"]
Perform Find/replace

go to layout [my layout].

RE: Check Box with a script behind it

(OP)
Sorry actually my script looks like

Go To layout(myLayout)
Enter Find Mode()
Set Field[myLayout::Select for editing]
Perform Find/Replace
go to layout [myLayout]

fist i tried the perform find/replace with no definitons

currently i have it specified To perform : find next

and in the find wha:
myLayout::select for editing = "Edit this record"

with matching whole words and searching through all records.

also i realized that the script actually asks the user to input some criteria as well as click the find button to continue the find.

I want it all automated. im just currently having a lot of difficulty setting this script up.

if im correct the script is to direct me to the layout i choose enters find mode in that layout and then goes into
the selected fied (in this case select for editing is my field) then performs a find on records that have the value Edit this record for my select record for editing field.

which is given if the checkbox is checked.

thank you again

RE: Check Box with a script behind it

I think we are talking about 2 different things here, or maybe 3.

What do want to achieve ?

Marking record to edit,
find records that are marked as to edit.

Then what is your criteria for a marked record ?

RE: Check Box with a script behind it

(OP)
Ok first i want to find records that are marked as to edit,
which i believe you gave me a suggestion

Go to layout(your layout)
Enter find Mode ()
Set field, your field (checkboxfield) 1
Perform find
Go to layout (your layout)

however i may have done something incorrectly,

after the records are found i want to switch it to a layout that will be view only from that layout the user can click a button taht will allow them to edit the found records

RE: Check Box with a script behind it

First you have to 'mark' the needed records.
You can use a script for that, after you have the criteria for a marked record.

I don't fully understand;'i want to switch it to a layout that will be view only from that layout the user can click a button taht will allow them to edit the found records'

Are those records locked that you want to switch to a layout where they can 'edit'records ?

RE: Check Box with a script behind it

(OP)
what i meant is that after the found set the user will be in a layout where the fields can not be entered, if they want to enter the fields they must press the edit found records button
which i have working

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close