Snapperhead Posted May 19, 2008 Share Posted May 19, 2008 I've been playing around with the scriptmaker a little. I have just compliled ~32 different search scripts that finds a particular set of records from "Table A". What I'm trying to do is capture the number of records (found count) for each script and enter the found count into a field in "Table B". I've sucessfully done this for one script, however I need to somehow combine 8 of these scripts to populate the 8 different fields in "table B", which will display the found count for each of these scripts.( and keep if possible - until the script is run again). Would it be possible to do this via (4) buttons on "Table B"? FYI "Table B" has 4 records , populated by other relationalship data and I need to assign the results (of the 8 scripts) to each of the (4)records. If anyone could help or suggest how to achieve this another way, that would be fantastic. Thanks Snap Link to comment Share on other sites More sharing options...
LingoJango Posted May 19, 2008 Share Posted May 19, 2008 Hard to say with so little information, but you do realize you can call one script from another, right? You could even subsume those 32 search scripts into one that you could call with different script variables. Assuming you keep your current 32 scripts, write one script that calls the 8 you need in turn and has each of those write to the appropriate field. I don't know what you mean by 4 buttons in table B. You can call a script from a button in any table and if you want one script to update all 4 records you can have it do that. Use Loop. Link to comment Share on other sites More sharing options...
Snapperhead Posted May 19, 2008 Author Share Posted May 19, 2008 I guess the biggest sticking point with me is the "How to" part.(I'm a typical newb - big on simple ideas - small on implementation) I read that I could call all the required scripts in a seperate script, However, before I do this - I'm a bit lost when it comes to getting (more than 1 set) of found record counts to to display in another table. That is, if I make a [super script] that calls [script1] before I call [script 2] I need to send the found count to a field in "table B". Then call [script 2], send found count to another field in "table B" (this is where im at a loss) then call [script 3]..etc to ..[script8]. I guess im not all that sure on what commands I should be trying to use in the script to make it send the found counts to "table B" in the first place. The only way I have got this to occur so far, is with a summary field on "Table A" then sending it onto "table B. The problem here is that for each script i run the found count changes. I will have 32 seperate summary fields if required! Thanks for being so helpful. Its greatly appreciated! Link to comment Share on other sites More sharing options...
LingoJango Posted May 19, 2008 Share Posted May 19, 2008 If you had FM9 you could use script variables. As it is, the simplest approach is to use global fields. These can be accessed from any table, whether or not there is a relationship to the current layout table. But if you post exactly what your database is about and what you're trying to achieve you may get pointers here that will save you a lot of trouble. If you can't be explicit due to confidentiality issues, try to find a suitable, highly comparable situation. Your generic description makes me think you should or at least could be doing this relationally (i.e. through relationships between A and B). If those searches are very hard-wired and their results are going to be used all the time, I'd go for a relationship. Link to comment Share on other sites More sharing options...
Snapperhead Posted May 19, 2008 Author Share Posted May 19, 2008 Heres a quick screenie. You should be able to see al the info you need there. The database is for a bus operator. The students are all listed on "Students register". The scripts I mentioned earlier all relate to finding students (records on the student register) that attend various types of schools ie primary,secondary,Tafe etc - on a given bus service. These found counts then need to be populated in "eligble students summary",This is an overall snapshot of a given service. On the eligble students summary" I have already included operator details & vehicle details.(through relationships). Now I need to populate eligble students summaries" with a summary of primary,secondary,tafe students and a total count of students on a given route.( this is what the scripts do) All of the other records on the other tables are pretty much hardwired. As far as I can see the records that will continually change the will be the student records. I hope my explanation is not too confusing. http://img179.imageshack.us/img179/9161/database1kk4.jpg Thanks again Snap Link to comment Share on other sites More sharing options...
Snapperhead Posted May 19, 2008 Author Share Posted May 19, 2008 Oh yeah dont worry too much about all the foreign keys on all the tables, I went a bit nuts in that department. Link to comment Share on other sites More sharing options...
LingoJango Posted May 19, 2008 Share Posted May 19, 2008 Hi, Still don't understand the function of the Eligible Students summary table. The info you want is per route isn't it? Then it should be in the routes table, even if you're accessing its content from the summary table. If it's per operator, it should be in the Operator table. I'm fairly certain you could manage to do this relationally, but scripts and global fields should do it if you're in a hurry. How many types of schools do you have? More than 6-7 and you might want to set up a Schooltype table. Link to comment Share on other sites More sharing options...
Snapperhead Posted May 22, 2008 Author Share Posted May 22, 2008 Okay i've been hammering away over the past few days and now I'm back try to find a workable solution to my OP. Assuming you keep your current 32 scripts, write one script that calls the 8 you need in turn and has each of those write to the appropriate field. What commands would you use/ or how would you structure the script described above? 1.Call a script form another script. (Perform script) 2.Get a found count these records 3.Write the found count to field1. 4. Repeat step 1 & 2 and write to field2 5.Repeat step 1 & 2 and write to field3......(repeat 8 times in total) I don't really need a script witten, just point me in the right direction for steps (2) & (3) and i'll work it out witha bit of trial and error. Thanks Again Snap Link to comment Share on other sites More sharing options...
Techphan Posted May 22, 2008 Share Posted May 22, 2008 SCRIPT Make as many Global entry fields as you have find criteria (fields by which you want to run the find) and enter the desired text/number. Then run the script: Go to Table (StudentTable) Show all records (maybe not necessary but I do this) Enter find mode Set field (StudentTable::Grade; Global::gGrade) Set field (StudentTable::Date; Global::gSearchDate) Perform find Set variable ($$StudentCount; StudentTable::Count) Go to Table (ResultsTable) Add new record Set field (ResultsTable::Grade; Global::gGrade) Set field (ResultsTable::Count; $$StudentCount) Set field (ResultsTable::Date; Global::gSearchDate) Commit record Go to table (SudentTable) Link to comment Share on other sites More sharing options...
LingoJango Posted May 30, 2008 Share Posted May 30, 2008 Perform script ( script1) SetField [ globalfieldforresults1 ; Get ( FoundCount ) ] Perform script (script2) SetField [ globalfieldforresults2 ; Get ( FoundCount ) ] etc. Link to comment Share on other sites More sharing options...
Snapperhead Posted June 1, 2008 Author Share Posted June 1, 2008 Thanks LingoJango & Techphan for your assistance. I have completed the "superscript" and It works perfectly. The whole database has come a long way since my original post. You guys are brilliant!! Link to comment Share on other sites More sharing options...
Recommended Posts