September 5, 200421 yr Hello, I can't seem to find more info on Portals. I have a couple questions: 1. I have the relationship setup to create new record when the user finishes a line in the portal and hits tab or select a field in the next line they can start the new record in the portal. How can I set this up so the user has to hit a button to create a new record for a portal and not have FM auto create the new record so the user can't do this in error? 2. I have 3 check boxes in a portal row (this is for a card collecting DB), 'own','Trade', & 'Sold'. I would like to change the color of the background for the portal when a user selects one of these buttons. I figured I could do a box in the background and some how code it to do a fill color when one of the checkboxes was selected. The problem is with a portal the record is added right away and there is no need for a save or commit button to run a script when you select a checkbox. I am also not sure how to do a color fill for a field in a script. 3. I would like when the user selects the 'sold' checkbox that it would look at the 'own' & 'trade' checkboxs and make sure they are not checked or uncheck it for the user. I am a little confused on how to run scripts to do these without a button. Thanks for the help, I have learned quite a bit from this forum. I can't wait til I can contribute more to others questions.
September 5, 200421 yr 1. you can set your relationship so that it does not allow the creation of related records. 2. The color is a calculated container field. Use a case statment to set the color. This a good place to use repeating fields. Make a global repeating container field. Put colors in the reps. Your case statement then sets the container used for the background the proper rep of the global. 3. Make a button with transparent sides the size of the checkboxes. Use these to run the scripts. The scripts can get a little tricky. You have to set the field as if the checkbox was clciked, i.e., if it is checked then it must be unchecked. Checkboxes store the data as a list separated by returns.
September 5, 200421 yr Author Ralph, If I turn off the allow the creation of related records, how do I run a script from a button to add a new record to the portal? Does the button have to be in the portal row? I would like the button to be outside the portal, is it possible? On #3, first off, how do I script it to know that it should only affect this portal row. Then would you add an 'if' statement to say if own = 1, trade =0, and sold =0 and so forth. This is still a bit confusing. Thanks for the help.
September 5, 200421 yr The button is outside the portal. The script has to store the key field value into a global field. Then go to a layout for the table, create a new record, set the foreign key to value of the global. Return to the original layout. The user can then enter data into the new portal row.
September 6, 200421 yr Author Ralph, That worked great. I am still stuck on setting the background color. How do you set the color? I have a field that is set as a calculation field. I tried to set the case as in Case ( own = 1;TextColor("" ;RGB (0;0;255);Available = 1;TextColor ("";RGB (0;255;0);Sold = 1;TextColor(""; RGB ( 255;0 ;0) ) ) I then setup the results as container with 3 repititions. Obviously I don't want to change the text color since there won't be any text. I can't seem to find a function to do a fill color. What is the secret formula? Thanks again, I hope I am not a pain ;-)
September 6, 200421 yr Author Ralph, No need to reply. I found a good example of this in the 'learning FMP' book. It works great. That is really a cool feature and looks great.
Create an account or sign in to comment