Newbies Dickh797 Posted February 24, 2009 Newbies Posted February 24, 2009 I was able to hard code a script "find" in FMP 5. But in FMP 8.5 I am having trouble. I cant seem to create 12 scripts associated with buttons to search for 12 different time periods on the same field. Hope someone has a little help on this question Thanks
LaRetta Posted February 24, 2009 Posted February 24, 2009 (edited) Welcome to FM Forums! You've come to the best place in the world for FM help! You should be able to create ONE find script and use script parameters (attached to each button) to specify what you want to find. Example: Button 1 finds records 15 days prior to today through today. Script parameter would be: 15 0 Button 2 finds records 30 days to 15 days prior. Script parameter would be [color:red]30 16 Button 3 finds records 45 days to 30 days prior. Script parameter would be [color:red]45 31 Find script would be: Enter Find Mode [ ] ... uncheck pause Set Field [ yourDateField ; [color:green]Get ( CurrentDate ) - LeftWords ( Get ( ScriptParameter ) ) ; 1 ) & ".." & Get ( CurrentDate ) - RightWords ( Get ( ScriptParameter ) ; 1 ) ] Perform Find [ ] Without knowing your specific criteria, this is the best example I can provide. Since vs. 7, script parameters (which allow you to attach a value to an action, namely a button press) are quite handy. Of course there are other ways as well; there always are. Also, I got lazy and used a space between parameters whereas, if I think there might be more than one 'word' on each side, I'd use pipe character and split them more carefully. Update: You can make the calculation (green) a bit more readable by using Let() as: Let ( [ today = Get ( CurrentDate ) ; from = LeftWords ( Get ( ScriptParameter ) ; to = RightWords ( Get ( ScriptParameter ) ] ; today - from & ".." & today - to ) // end Let Corrected the items in red - the first number should be the OLDEST. I had them reversed, sorry. Edited February 24, 2009 by Guest Corrected red (blush)
Recommended Posts
This topic is 5751 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