oilman Posted February 20, 2003 Posted February 20, 2003 Hi all I have a program that calculates welders repair rate. Once a welder repair rate has been calculated for the month, a script is run and the information is deleted to calculate the next welder repair rate. I would like to save this information now to a second db. The second db has fields for each month of the year. I would want to transfer the repair rate percentage calculated only to the second db for each month automatically. I have made a relationship using the welders stamp and have checked the created a related record and use the set field command to create a record in the second db. This is what i have tried sofor in a script: set field["pwr","isempty(jan)"] set field["pwr","isempty(feb)"] This script is in the second db and attached to a button that run the script as an external script from the first db. I also tried the "isvalid" command. I get this message for both version "This field cannot be modified". I also tried the above script in the first db and i get the same message. example first db has the field "pwr" second db has the fields "jan" "feb" "amr" and so on. i want to install the result of "pwr" in the correct month in the second db. I hope this is clear enough for you to understand because for a cajun it is hard to explain something without using his hands. thank in advance Lionel
LiveOak Posted February 20, 2003 Posted February 20, 2003 I think I understand what you are trying to do, but I'm confused by how you are trying to do it. The statement: SetField["pwr", IsEmpty(jan)] sets the field "pwr" to a one if the field "jan" is blank. I don't think this is want you intended. If you want to set the field "jan" to the value in the field "pwr", the statement should look like: SetField["jan", "pwr"] I also don't think it is you intention to set all the month fields to the same thing (pwr). The SetField command may or may not automatically create a record in the second file, depending upon how your relationship is set up and whether the is already a record for a particular welder in the second file. I sounds like you might have some major disconnects about how FM works, but we'll need more information about what exacty is the format of your files to be of definitive help. -bd
oilman Posted February 20, 2003 Author Posted February 20, 2003 Thanks for the quick response LIVE OAK I understand what you are saying but Yes I would like for "pwr" to fill in each month in the second db. The first db is use only to calculated the repair rate. There are thirty fields in the first db. Only the pwr field needs to be saved. can this be done on one record or would it take twelve record per welder and view this through a portal. Thanks Lionel
LiveOak Posted February 21, 2003 Posted February 21, 2003 Either probably would work. A lot depends upon what you are eventually going to do with the pwr data in the file that is it's eventual destination. The absolutely fundamental question in database design is "what is a record?" in a file, that is, what does each record represent. If you answer this for both files, the how can become clear. It's often hard to answer a "tree" question without more of a view of the "forest". -bd
oilman Posted February 21, 2003 Author Posted February 21, 2003 Thanks for the insight Live Oak Got it figure out at least one way but would like to know if there is another or better way. Here is what i have come up with. First db will be used once a month to calculate welder repair rate. Second db will have twelve fields call the months of the year The script attached to a button reads like this If[isEmpty(seconddb:jan) Set Field("seconddb:jan",prw") else If[isEmpty(seconddb:feb) Set Field("seconddb:feb","prw") else and so on until the last month of the year is reached This works and will add the percentage for twelve months into one record. Could you think of a better way of doing this. Would like only one record per year per welder because there will be up to five hundred welders in the second db. Thanks Lionel
LiveOak Posted February 22, 2003 Posted February 22, 2003 The only downside would be if you wanted to print all the scores for January with a total, then all the scores for February with a total, etc. A single record can only be one place in the sort order, you would be forced to run 12 reports to do this. If you don't need to look at each welder/month individually, your structure might be fine. Don't worry too much about the number of records. FM is faster and more efficient with many records with few fields than with few records with many fields. A good example is timekeeping. It is better to have a single record in a timekeeping system be a person/project/date/time interval than create an entire spread sheet in one record. These small atoms of information can be sorted/combined/displayed in many ways, but it is hard to break information out of a record with many different time slots/projects/people/dates, etc. If you want a spreadsheet view, it can be created with relationships. -bd
oilman Posted February 24, 2003 Author Posted February 24, 2003 Thanks for the information -will consider - problably will revamp. Lionel
Recommended Posts
This topic is 7947 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