9 Replies Latest reply on Nov 16, 2009 3:23 PM by nolak37

    making buttons from tables

    nolak37

      Title

      making buttons from tables

      Post

      Hi everyone,

       

      Im not sure if this is possible but im trying to make an option on a project im worling on where the users can make or add buttons to a layout. These buttons are gonna be used to insert text to a field, I know hot to create these buttons and have them do just that however it seems the process is gonna be too long and complicated for the users of this database.

       

      Here is what I was thinking

       

      On the original layout add a button that opens a new table and go to a layout i have in table view fot the table "buttons" where each record of this table will be a button.

       

      BUTTONS

           Button ID

           Button Name

           Sentence

       

      Once here all they need to do is add a new record and then close the window. Going back to the original layout.

       

      What i dont know is how  can have the buttons automatically added to the original layout.

       

      I tried adding a portal but this doesnt seem to work, the portal just displays empty. (maybe my relation between the tables is wrong)

       

      I also tried adding a checkbox field and display values from that table, this almost worked fine, the only problem is that as i check the different options they get added as lists and i can only select an option once, when what I need is to display there sentences together to make one long sentence or paragraph.

       

      Ive been looking for alternative ways but ive only been using FM for 3 weeks and am completely stuck.

       

      By the way i have FMpro 10

       

      Any Ideas Help

       

      Thanks

        • 1. Re: making buttons from tables
          RickWhitelaw
             What you describe seems odd. If you post the reason why you would want to have the user create new buttons perhaps one of the members here could help. At first glance, even if what you describe is possible (it isn't in any acceptable sense), it isn't advisable. A button,after all, is a layout object. If you allow creation of buttons, you're allowing manipulation of your basic layout design, no? I'm thinking it's something else you need to accomplish and that perhaps the way to do this isn't yet clear to you. If so, describe your objective and ask away! People here are quite helpful.
          • 2. Re: making buttons from tables
            philmodjunk
               It is possible to define fields as buttons and script the buttons to use the text entered in such a field to control the script assigned to the button. You might try a list view rather than a table view layout. I can't say whether this approach is advisable or not without a more detailed description or example of what you're trying to do, but it is possible to do.
            • 3. Re: making buttons from tables
              nolak37
                

              Yes I see your point,

               

              Well in my case having the user be able to modify this part of the layout isnt a bad thing however I dont want to give them privlages to modify everything.

               

              ok, let me clarify my situation,

               

              when one of our 2 doctors sees a patient he writes a diagnosis (e.g. patient suffers of abdominal pain and shows signs of bruising in upper rigt quadrant)

              so in my layout I have buttons for:

               

              Bloating

              Bruising

              swolen

              pain

               

              When you press pain for example the phrase "suffering from abdominal pain" gets added, this is much faster than typing especially with the doctor that types with 2 fingers at a rate of 5 words a min.

               

              As the doctor discovers he is using a phrase or sentence often i would like him to be able to add a button that types or enters that text for him.

              I dont want to have to do this myself because I will simply not have the time.

               

              any help is apreciated and thanks in advance

              • 4. Re: making buttons from tables
                philmodjunk
                  

                Create a related table where each doctor can enter their "common phrases". Design the relation ship to this table so that each doctor can see only their phrases in a portal on your layout. Write a script such as:

                 

                Set Variable [$Text; Value: PortalTO:: PhraseField]

                Set FIeld [MainTable::TextField; MainTable::TextField & $Text ]

                 

                To append this text to the end of a designated text field.

                 

                An Alternative might be to set up a conditional value list on a Global text field that lists the same phrases from the same table with auto-complete enabled in a combo box. A script trigger set for OnObjectExit could then append the selected text.

                • 5. Re: making buttons from tables
                  nolak37
                    

                  Hi Phil,

                  Ive been reading many of the posts here trying to learn as much as i can as fast as i can since i have no experience in this field and let me just say u are full of usefull information.

                   

                  Thanks for your reply, I have tried doing what you said but hit a snag. i tried making the script you mentioned but when i hit OK button i get the following message.

                   

                  An operator (e.g. =, -, *, ...) is expected here.

                   

                  any thought as to what i might be doing wrong?

                   

                  I went to manage scripts and tried creating the script, and yes I did replace "mainTable" with the name of my table as  wel as FieldName.

                   

                  Thanks again. Please remember Im a newb Breaking it down barney style would produce the best results, lol

                   

                  • 6. Re: making buttons from tables
                    philmodjunk
                      

                    This is a common "Newbie" experience.

                     

                    Set Field has two specify... buttons. The first specifies the target field. (field left of the ; ) The second specifies the calculated result (Expression to the right of ; ).

                     

                    Add Set Field to your script and with it still highlighted, click the Specify Target Field button to select MainTable::TextField.

                    Now click the second Specify... button (calculated result) and enter the text to the right of the semicolon: MainTable::TextField & $Text

                    • 7. Re: making buttons from tables
                      nolak37
                        

                      OK, Great i understand and it went through.

                       

                      Im a bit confused though, i created the script as you mentioned and when I added the portal to the layout it still doesnt display all the information it should, Did I miss something?

                       

                      So here it is I have the tables "Common Phrases" and "Medical Visit".

                      There Is a "Visit ID" field in "Medical Visit" with Type set as Number and Auto-enter Seria

                      i then have a Button ID in "Common Phrases"  type also set as number.

                       

                      I then set a relationship between those two. and i created the script you mentioned

                       

                      Where or how do i apply the script? 

                       

                      I have a layout for each of those tables and a third layout where when you press on the "abdomen" button in "medical visit: the layout opens in a new window, this should display the buttons already set for that doctor or part of the body.

                       

                      I created the layout and put in a portal for the Buttons, is this correct, do i have to add the script to the portal and if so How?

                       

                      Thanks

                       

                      • 8. Re: making buttons from tables
                        philmodjunk
                          

                        Let's look at your relationship first. Do you have a field in your record that uniquely identifies the doctor? That field, preferrably a serial number should be the key field used to set up the portal--that way a doctor sees the same list of phrase records no matter which visit or patient he/she is currently working with.

                         

                        Medical Visit:: DoctorID = Common Phrases:: DoctorID  (enable delete and "Allow creation of records..." options for the Common Phrases table occurrence.)

                         

                        On a Medical Visit based layout, create a portal to Common Phrases and add just the "Phrases" text field. Since your doctor will need to add their own phrases, let's enhance my suggested script:

                         

                        If [Isempty (Common Phrases:: PhraseField ) ]

                          # Put cursor in clicked phrase field so they can enter a phrase

                          Go to Field [Common Phrases:: Phrase Field]

                        Else

                          Set Field [Medical Visit::TextField; Medical Visit::Text Field & Common Phrases:: PhraseField]

                        End If

                         

                        In your portal add just the Phrase Field and resize it and its portal so that there is enough open space in the portal for two small buttons to the right of the field.

                        In the portal setup enable the scroll bar and also enable deletion of portal records.

                         

                        Select the Phrase Field and use Format | Button Setup... to specify that the above script be performed when the field is clicked. If the doctor clicks the field when it's blank, the cursor will appear in the field so that they can add a new phrase. If there is text in the field, clicking it appends it to your specified text field.

                         

                        You'll want at least two button to give your doctors additional control over their phrases: Create a button with just the letter "D" as it's label and set it to "Delete Portal Row"--this enables the doctors to delete a phrase if they decide they don't want it. Create a button with just the letter "E" as its label and set it to Go to Field [Common Phrases:: Phrase Field]--this button will allow the doctor to edit an existing phrase.

                        • 9. Re: making buttons from tables
                          nolak37
                            

                          Hey it works,

                           

                          Thanks Phil, I thought id go crazy before getting this to work