Jump to content

find for reports


NeoCryptic
 Share

This topic is 5648 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have this database set up so that it has software and non-software assets. There is a radio button that indicates which one is which.

When it's in browse, my next/previous buttons change the layout accordingly. Right now I'm working on a button that will search the records, find the software/non-software records, and send only the matching records to the print layout. Say print software records...and only those get sent to the print layout.

If anyone can help...I'm finding the sequence a little confusing.

Thanks.

Link to comment
Share on other sites

Again I would use one script, but send a script parameter from each button. I also generally like to put the script parameter into a variable right at the top, mostly for readability:

Set Variable[ $var ; Get ( ScriptParameter ) ]

Enter Find mode

Set field[ asset type ; $var ]

Perform Find

At this point you would go to layout using the method from your navigation script.

You may also want to consider what happens when no records are found, but we can leave that for another day.

Link to comment
Share on other sites

Thanks again Tom for replying. Attached is my script. It returns that there is no valid search criteria. I know I'm doing something wrong, but I'm not sure how to fix it. I'm brand new to FileMaker as of the other day...trying to jump in.

The thing is...if I just do a regular find...and select the Non-Software radio button, it works, but it doesn't even work for the Software radio button. For some reason, the radio buttons won't get selected in a search. ??

script.jpg

Edited by Guest
Link to comment
Share on other sites

Is the button that runs the script actually passing a Script Parameter? The parameter should be the actual search term, e.g. "software" ...

Link to comment
Share on other sites

The parameter is passed from your buttons:

1. Create a button, or select an object and choose Format->Button Setup...

2. Click Perform Script and then the Specify button.

3. Select the script from the list

4. Look down at the bottom where it says "Optional script parameter" -- that's where you put "software" for one button and "non-software" for the other.

See how that works? By passing a different parameter from each button you can have several buttons use the same script.

A parameter doesn't have to be just text, either; it can be a calculation. For example, your button's parameter could be assets::asset_type and the script above would then find the records that match the current one; so you'd only need one button instead of two (if you wanted it to work that way).

Sorry, I had presumed from our previous discussion that you had successfully used a script parameter.

Link to comment
Share on other sites

Thanks very much for helping me out.

Sorry I made it seem like I got the script parameters earlier...I got it to work without them. The major hangup I had was just seeing how to get the radio values.

The step-by-step really helped. Thanks. Now the search is finally working...with one glitch. The "non-software" search works and returns 317. The "software" search is returning the total 374. It should only turn up 57 records. I guess it's finding everything that includes the word "software" so the "non-software" gets included?

Is there a way to exclude or omit the "non-software" out of that?

Sorry if my explanation is confusing.

Link to comment
Share on other sites

Change the line:

Set field[ assets::asset type ; $var ]

to this:

Set field[ assets::asset type ; "==" & $var ]

What's going on is that "non-software" is indexed as two words because of the hyphen. Look up (Finding, sorting, and replacing data > Finding records > Finding text and characters) in the online help for more details.

Link to comment
Share on other sites

This topic is 5648 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.