NeoCryptic Posted June 20, 2006 Posted June 20, 2006 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.
Fitch Posted June 20, 2006 Posted June 20, 2006 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.
NeoCryptic Posted June 20, 2006 Author Posted June 20, 2006 (edited) 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. ?? Edited June 20, 2006 by Guest
Fitch Posted June 20, 2006 Posted June 20, 2006 Is the button that runs the script actually passing a Script Parameter? The parameter should be the actual search term, e.g. "software" ...
NeoCryptic Posted June 21, 2006 Author Posted June 21, 2006 Should I just replace "ScriptParameter" with "software"? Or where to I define the ScriptParameter? Sorry...new to this.
Fitch Posted June 21, 2006 Posted June 21, 2006 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.
NeoCryptic Posted June 22, 2006 Author Posted June 22, 2006 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.
Fitch Posted June 22, 2006 Posted June 22, 2006 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.
NeoCryptic Posted June 22, 2006 Author Posted June 22, 2006 Oh my god, thank you sooo much. I tried == and such, but I wasn't sure of the syntax. Thanks again for all your help! You have no idea how frustrated I was getting. Thanks :P
Recommended Posts
This topic is 6729 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 accountSign in
Already have an account? Sign in here.
Sign In Now