Art Posted February 5, 2008 Posted February 5, 2008 After looking and looking and looking, I still haven't come up with a good way to do this. Here's what I'm trying to do: 1. I have a birthday (mm/dd/yyyy) stored in a date field. 2. I would like to have a dialog appear that would ask for the month I'm looking for (such as "3" - not necessarily "March") 3. I want to use that input to find all the records with the month of "3" in the birthday field. 4. I then want to sort the records by the day of the month found and then print the list. 5. After printing the list I want to go back to my full layout sorted by name. I've been beating my head against the wall trying to figure out how to do this "simple" task. Thanks for any help
comment Posted February 5, 2008 Posted February 5, 2008 3. Use a * wildcard in your search (i.e. "3/*/*" in your example). 4. You will need a calculation field = Day ( YourDatefield ) to sort by. 5. If you start by opening a new window, you can perform your search, sort and print in this window. Then close the window to return to your original found set. See also: http://www.fmforums.com/forum/showtopic.php?tid/182474/ http://www.fmforums.com/forum/showtopic.php?tid/179538/ http://www.fmforums.com/forum/showtopic.php?tid/179057/
Art Posted February 5, 2008 Author Posted February 5, 2008 Thanks for the suggestions. I read the posts that you listed but didn't find the solution I was looking for. I already tried the wildcard approach and that seemed to work except for one little detail, which is why I put up the post to start with. I can do a manual find and type into my birthday field something like "3/*/*" and it will immediately find all of my records where the month is March. It's then a relatively simple thing to sort the records. And printing isn't really the problem either, nor going back to the sorted file like I need to do. The problem comes with trying to do this all in a script that will follow automatically. And the main problem is getting that dumb "3" into the script. I had thought of trying to set a local variable (since everything is contained in one file and script) but I can't figure out how to throw up a dialog that says, "Type in the month you're looking for", have the user type in a number, and then get that number to join up with the "/*/*" part of the find.
comment Posted February 5, 2008 Posted February 5, 2008 User input has to be into a field. You can enable user input in a custom dialog - but it has to be into a field. Either define a global number field for this, or enter Find mode first, then let user enter their choice into the date field itself. In both alternatives, you need to to modify the entry by: Set Field [ YourDatefield ; EnteredField & "/*/*" ]
Art Posted February 5, 2008 Author Posted February 5, 2008 In both alternatives, you need to to modify the entry by: Set Field [ YourDatefield ; EnteredField & "/*/*" ] This is driving me nuts. I know it has to be simple but my brain just isn't getting it. I made a global number field. I made a custom dialog using that field. The user enters the number 3 into the field. That is working as it should. The number shows in the field that I made on the layout. Now I want to script a find using that number in my birthday (date) field. I use the script step "Perform Find" and try to set the criteria. I choose the "birthday" field and then try to enter into the criteria field either =MyGlobalField & "/*/*" or I put into the criteria field ==MyGlobalField and it says, "NO! You can't do that. That's a date field." So what in the world am I missing? Remember, I want to script this find. I don't want to "set" the birthday field. So I tried making a text global field and setting that to use as a match in the criteria box but that didn't work either. Thanks for helping a knucklehead.
comment Posted February 5, 2008 Posted February 5, 2008 You can only enter STATIC criteria into stored find requests. For CALCULATED criteria, you need to use Set Field[], e.g. Enter Find Mode [ ] Set Field [ FieldToSearch ; < calculated criterion > ] Perform Find [ ] Note that no find requests are specified for either Enter Find Mode [] or Perform Find []. So your script should look roughly like this: Show Custom Dialog [ YourTable::gNumber ] Enter Find Mode [ ] Set Field [ YourTable::Birthday ; YourTable::gNumber & "/*/*" ] Perform Find [ ]
Art Posted February 5, 2008 Author Posted February 5, 2008 Finally! I am quite grateful for the assistance. At last I got this thing to work. I appreciate your counsel. It did the trick.
Recommended Posts
This topic is 6135 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