saraswati Posted July 25, 2003 Posted July 25, 2003 Hi ! I need to pull out records from a database based on professor name. I have created a layout for that so when the script is executed I will get the professor names in that layout. But the problem is I dont want multiple records. The mySQL query could have been something like: SELECT DISTINCT(prof_name) FROM mytable WHERE 1 Could anyone please help me how to do this in Filemaker ?
ernst Posted July 25, 2003 Posted July 25, 2003 Hello Saraswati, >>But the problem is I dont want multiple records. I don't understand this. What do you want to happen if there are more then one records matching your find criteria??? Or do you mean 'View as Table' versus 'Vies as List'? Regards, Ernst.
saraswati Posted July 25, 2003 Author Posted July 25, 2003 i want to view as a list all the distinct names of professors.
-Queue- Posted July 25, 2003 Posted July 25, 2003 You should, I think, already have a Professors file that would only have one record for each professor. If not, it sounds like an entity you should create.
saraswati Posted July 25, 2003 Author Posted July 25, 2003 my problem is the database file is a student database where student ID is the primary key.
saraswati Posted July 25, 2003 Author Posted July 25, 2003 there is no professor file name of the professor is just a field in the student database
Ugo DI LUCA Posted July 25, 2003 Posted July 25, 2003 Your goal is not that clear.... Do you want a list of "professors" related to a specific student_id, or do you want to list all professors currently entered in the professor field for the Student database. I have the feeling that your 'professor' field is a repeating field. As Queue suggested, the correct setting would be to have the Professor a related record in another database. But as FM offers multiple ways to achieve any goal, there surely is a solution, but it would depending upon your file structure, which we don't know much by now.
Razumovsky Posted July 25, 2003 Posted July 25, 2003 It is a little unclear what you are trying to do, but if Professor names are entered in a field in your student db, create a value list "professors" which uses all values from this field. You can then make a calc field that displays this value list giving you all the professors from all the records. -Raz
saraswati Posted July 26, 2003 Author Posted July 26, 2003 hi ugo ! i want to list all the professors that are in the database. One student can take classes under different professors. Does this sound clearer?
Ugo DI LUCA Posted July 27, 2003 Posted July 27, 2003 Hi, It doesn't help unless you specify the field format for 'professor'. Is it a repeating field ? Or do you have 20 different fields for each course teacher...?
saraswati Posted July 28, 2003 Author Posted July 28, 2003 the professor field format is a normal text. If a student has taken 3 courses under 3 different professors there will be 3 different records with the student data duplicated in the 3 records.
Ugo DI LUCA Posted July 29, 2003 Posted July 29, 2003 Well, consider having a Professor file. As you describe your setting, it's a hell of a job you're doing as the professor name would be entered successively a lot of time. A value list would help in that process, and a single relationship to the Professor File would get you to the list you're looking for. Now, if you persist this way or cannot change the setting, her's what I suggest for the case you explained, assuming you have a serial number (or record_Id) in that file... Create a selfJoin on the Professor field, by a relationship StudentFile:Professor::StudentFile:Professor. Create a Calculation c_showOnlyone = Case(Record_Id=:SelfJoin::Record_Id,1,0) Then, create a list layout displaying the Professor Name, and use this script. Find Mode Go to Layout Main SetField (c_showonlyone,1) Perform Find Sort (by Name) Go to Layout "Professor Layout" As the c_showOnlyone is an unsored calc, it would take some time, but it should work that way.
Recommended Posts
This topic is 7791 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