jasongodoy Posted January 13, 2006 Posted January 13, 2006 Does anyone know if it is possible to perform a find request "Find[Restore]" on a script variable "$my_num" that is declared and set in the same script? Thanks, J
Ender Posted January 13, 2006 Posted January 13, 2006 You can perform a find using the contents of a script variable as the criteria like this: ... Enter Find Mode [] Set Field [ field ; $my_num ] Perform Find [] ...
Breezer Posted January 13, 2006 Posted January 13, 2006 (edited) Try this: Enter Find Mode [] Set Field ["MyNumberField"; $my_num] Perform Find [] Ender beat me to it Edited January 13, 2006 by Guest
jasongodoy Posted January 13, 2006 Author Posted January 13, 2006 Thanks for the quick response Ender & Breezer! This method works well for one Find, but I guess then my next question is, what happens if I want to perform a Find on 6 Script Variables? This is why I was trying for the "Find[Restore]". For example, I have a "Tests" field in my database. A record in the database can have multiple tests performed on it. Test numbers can range from 1-100. For this little project I'm doing, I want to be able to Find records on no more than 6 tests. So, if I wanted to find records that had just 3 certain tests performed on it, I would enter criteria in only 3 of my 6 test fields - test_field1 = 1, test_field2 = 33, and test_field3 = 99. I want to get all records that have had those test numbers performed on them. How would I structure this Find? Thanks, J
Ender Posted January 13, 2006 Posted January 13, 2006 Your structure is not very clear here. 3 criteria for 6 test fields with 100 tests?? I don't get it. And what was the script variable for again? Perhaps you can explain what each record is and how these multiple tests fit in.
jasongodoy Posted January 13, 2006 Author Posted January 13, 2006 Sorry for the confusion Ender. In Browse mode, there are six fields for someone to enter in test numbers. Test numbers range from 1-100 (Test 95, Test 60 etc). The tool I'm developing lets people look for records which have had varioius test performed on them. Normally no one will ever need to perform a Find on more than a combination of 6 tests (hense six fields). So someone can look for a record that may have had (Test 4 and Test 76) only or they could perform a Find again to see if there are any records matching Test 4, and Test 10, and Test 56, and Test 70, and Test 88, and Test 90. I'm just trying to perform a find based on the criteria that the user specifies. Since I'm in browse mode, the script variables come into play because I capture what the user enters in any of the six fields on my layout, store it, then use it my script later on. What would be a good way to approach this problem?
Breezer Posted January 14, 2006 Posted January 14, 2006 I'm sure Ender will not like my recommendation but, how about using global fields for your find criteria?
Ender Posted January 14, 2006 Posted January 14, 2006 No, no, with the current structure, I think a global (or set of globals,) would be needed. I'm just trying to figure out how to get the find script to work. I'm thinking it would be better to use a separate table to record the tests (each Person can have many Tests.) And then use relationships from global search fields to the Test table. But this gets tricky as well, to avoid finds on an unstored calc.
Breezer Posted January 14, 2006 Posted January 14, 2006 I agree with you Ender, the structure needs to be revisited. From what I can tell, there are some redundant fields which can be resolved by using a 1:M relationship. I wouldn't be surprised if each test has been setup as it's own field, hence, TEST1, TEST2...TEST100. QUESTION to Jasongodoy: How is your current structure set? We will need more information to effectively help you further.
jasongodoy Posted January 16, 2006 Author Posted January 16, 2006 OK guys, I'm so sorry for all this confusion. Here is my last question that would probably put me on the right track. How do I use Constrain Found Set properly?... How do you perform multiple Finds on the same field (in my case, "Test_Num" field)? What I want to do is from within a script, search for records that have Test # 105. Once the Found Set for Test # 105 comes up, within that Found Set I want narrow or constrain that found set to records that contain Test # 105 and Test # 107. I tried using Constrain Found Set but with no luck. I suspect I might be setting this up wrong. I hope this is clear. J
jasongodoy Posted January 16, 2006 Author Posted January 16, 2006 Got it! I had to end up using "Extend Found Count". Phewww. Thanks guys.
Conartist Posted April 6, 2006 Posted April 6, 2006 I have a question along the same lines as the original question in this post. I work for a trade show decorating company. We take orders from individual exhibitors at a tradeshow event. Then we need to make reports that show how many blue tables, red chairs, etc. are ordered for each show. Currently I have hard coded report functions that either produce reports that have "all items ordered" or "all chair orders only" etc. What I would like to do is be able to create a customizable report that a user could designate what they want in the report (i.e. a report with carpet and chairs). My current structure has a table for inventory items (item description, taxable, etc.) and a table for invoice line items (exhibitor 1 ordered 1 blue table). In the inventory table I have a field for report type (carpet, table, chairs, etc). I need the report to pull from the line items because I need to know the quantity and the exhibitor in the reports. What I would like is a layout where the user can choose report type from a checkbox and then a report is created based on their selections. The hard coded reports I use now first get all related line item records (based on the trade show) and then use the constrain found set step based on report type to find only those items in the needed report type. What I have been trying to do this morning is use the data created by a report type checklist (stored in a global field) to run the constrain found set steps. Since the checklist returns an array I am taking steps to parse the data into each individual report type using Set field [showfacts::Current_report_type; LeftValues (Showfacts::G_select_report_type ; 1 )] This leaves me with the first report type seperated out into field "current_report_type". What I wanted to do next is get this value into the find step and use it as the first find where lineitems::report type = current_report_type. I would then use a looping script to grab each selected report type one by one. Since I can't do a find where lineitems::report type = current_report_type, I tried using a variable(i.e. set variable $current_report_type = current_reporty_type and then use the variable in the find step but this didn't work. I'm not sure if it is because you can't use variables in the find step or because I wasn't getting rid of the trailing return correctly or what. I know this probably isn't the best way to go about this but I thought I would push ahead and learn something in the process. Now I'm just feeling lost. Any suggestions are greatly appreciated as I think I'm finally past the basic concepts of FM and need to move into the more advanced techniques to improve my database.
Recommended Posts
This topic is 6806 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