4 Replies Latest reply on Jan 18, 2010 2:06 PM by hsutton47

    Pop-Up Form Creation



      Pop-Up Form Creation


      Hello, totally new to Filemaker.  There are two things I am trying to do and am totally lost. I am trying to re-create a very old legacy Contacts-type db using a pre-made FM Contacts db as a starting base.


      1.  First, in a Browser-type form display the old db takes 3 fields (NameFirst NameLast and Company) and combines them into one sorted calculated result.


      If the record has all 3 fields populated, the display shows format "NameLast, NameFirst - Company" in the browser's sorted list.

      If the record only has the Company field populated, then that field appears in the sorted list.

      And of course if only the Last/First Name fields are used, those appear in the sorted list.


      I notcied in a pre-made FM Contacts db, they have these three fields in a browser display along with a calculated "Full Name" field.  I duplicated it to play with it and try to break it down so I could get the affect I need.


      This is what is there now:  


      Evaluate ( "Name_First & \" \" & Name_Last" ; [Name_First ; Name_Last] ) 

      which results in this exampled display in the browser form:  John Smith


      What I am trying to do is first, reverse those two fields [Name_Last] followed by a comma & space, then [Name_First] followed by space-dash-space & [Company] field


      What I did was:


      Evaluate ( "Name_Last & \" \" & Name_First & \"\" & Company" ; [Name_Last ; Name_First;Company] )


      The display result is:                  Smith JohnABC Company

      I am trying for the result:           Smith, John - ABC Company


      If only the company field is populated, the result would be "ABC Company" and the separating characters of ", " and " -" would be discarded.


      If only the NameFirst & NameLast are populated, the result would be "Smith, John" and the " -" used to plug in the [Company] field would be dropped.



      2.  Once that is done, if a user needs to edit that combination, I want to duplicate what the old program does.  If you click on a button next to the calculated Name/Comapny field, a pop-up form appears for that record with the 3 fields available for editing.  Once you edit the fields as needed and save it, the form disappears and the underlying displayed browser form shows the edited result by refreshing/recalculating the field.



      Regarding the pop-up form, I can create a form with desired fields but cannot figure out how to "shape it" into a small window that then would pop-up when clicking a button on the browser form.  Any help to point me in that direction greatly appreciated.


      Hope this makes sense. Thanks, Hershel

        • 1. Re: Pop-Up Form Creation

          2 things - 1) you don't need the evaluate function. Just use a calculation field with a calc like this one:





          //we're shortening the names of the fields 

          fn = firstnameField;

          ln =  lastnameField;

          co = companyField 





          //if co is not empty and fn is empty or ln is empty, show company only 

          co <> "" and (fn = "" or ln = "");  co;


          //if co is empty and fn and ln are not empty

          co = "" and fn <> "" and ln <> ""; ln & ", " & fn;


          // all three fields are not empty

          co <> "" and fn <> "" and ln <> ""; ln & ", " & fn & " - " & co;


          //in all other cases, show nothing 




          If you are going to use this field to make a drop-down or pop-up menu, make sure to turn on indexing. 



          2) to do a popup you can use a script that opens a window. to resize it automatically, use the Adjust Window script step, set to resize to fit.


          Make sure you set the Allow User Abort script to off before this. Then pause the script. This will make a "modal window". Then a script step to commit the record, and finally close the window. Make sure you put a button on the pop up window layout that will resume script.



          • 2. Re: Pop-Up Form Creation

            Don't see any reason for using Evaluate here.


            Name_Last & ", " & Name_First & " - " & Company is the basic calculation here, but of course you don't want , and - to appear unless there is a first name and a company name so we have to add some if functions:


            Name_Last & if(not isempty (Name_First ); ", " & Name_First )  & If ( not isempty (company) ; " - " & Company )


            For a pop up, you have two choices, New Window--which has a windows OS bug and can be complicated to set up and Show Custom Dialog. The Show custom dialog can have up to three input fields so these could be your first, last and company names.

            • 3. Re: Pop-Up Form Creation
                 Your calculation text info worked great.  Thank you!  I am having a little trouble with the second part but the alternate suggestion to do a custom dialog box is a quick fix for now. 
              • 4. Re: Pop-Up Form Creation
                   Thanks for your custom dialog info.  It works great as a way to get this functional pretty quick.  Thank you!