8 Replies Latest reply on Sep 19, 2013 11:12 AM by BorisKamp

    validation = not empty

    BorisKamp

      Title

      validation = not empty

      Post

           Hi guys, 

           I have some wierd problem (for you it might make sense :P )

           I have a few field in my record that I want to validate not to be empty upon commiting record those are:

             
      •           Fund type
      •      
      •           street
      •      
      •           city
      •      
      •           state
      •      
      •           district
      •      
      •           etc.....

           For the fields Street, City and District I've setup a popup menu with values from another field ( I do this to prevent users from entering slightly different information such as Greenview or Green-view, you'll get it.

           For the users to add a street, city or district that is not yet in the list, I've setup a button with a script to create a popup window for them to create a new street, city or district. when entered they can click the "add" button to commit and close the record (popup window). after adding, they can select it from the pop-up list. 

           I find this a great way but got my first conflict! When I set the above mentioned fields to validate with the requirement of "not empty" in the validation tab , Filemaker validates them when A user clicks the "Add" button to add a street , district or city in the popup window where they add them...

            

           How can I fix this?

            

            

        • 1. Re: validation = not empty
          philmodjunk

               You might want to remove the validation setting and instead set up the OnObjectValidate script trigger on each of these fields to run a script that checks the field to see if it is empty.

          • 2. Re: validation = not empty
            BorisKamp

                 Thanks for your suggestion, unfortunately I have no idea where to start, can you please help me out? 

            • 3. Re: validation = not empty
              philmodjunk

                   From the many questions that you've been asking, over the last few days, the best place to start is with tutorial and training materials to provide you with a broader based knowledge of FIleMaker and relational database design. There are a number of different books, videos, etc. that are available for that purpose.

                   Do you know how to create a script? If not, that's the first thing you'll need to learn.

                   Do you know what script triggers are? if not, please look them up in FIleMaker Help and any training resources you might have.

              • 4. Re: validation = not empty
                BorisKamp

                     I already followed 15+ hours of video tuts from Lynda, they cover most parts but do not go deep in all the script and calculation functions.

                     and thats the part I have most problems with, I cant seem to find how to implent all those calc values and thus cant create above easy grade scripts or so myself.

                     as for you last two questions, yes I perfectly understand those parts.

                     But again I have trouble with all the functions.

                     Do you have a great tip on how to get familiar with them?

                     I Appreciate you helping me! thanks!

                • 5. Re: validation = not empty
                  philmodjunk

                       The functions are all listed in FileMaker Help, both alphabetically and by "category". Just search under "function".

                       My questions were intended to try to identify a starting point. If you know about scripts and script triggers, you have most of what you need to know to do this. But on further thought, I don't think my suggestion will work here.

                       

                            For the users to add a street, city or district that is not yet in the list, I've setup a button with a script to create a popup window for them to create a new street, city or district.

                       How is this supposed to work? Is all of this data being entered into a single table or do you have separate tables for each of your pop up value lists? On what layout is the table in your pop up window based? (or is it a custom dialog?)

                  • 6. Re: validation = not empty
                    BorisKamp

                         Hi Phil,

                         Thanks for replying! I have done it the following way:

                           
                    1.           I have a "properties" table with all the fields included in my main layout
                    2.      
                    3.           in the properties table i defined three fields called streets, cities and districts
                    4.      
                    5.           I created a new layout for each with one field in them (streets, cities, districts) and a button to commit the record and close the window
                    6.      
                    7.           I created buttons on the main layout with add "streets" etc and assigned the following script:

                    New Window
                         Go To Layout
                         Hide Toolbars
                         New Record

                         Thats basically it, I hope I explained it the right way. 

                         Coming to think of what I learned in the past days, I think I should create three new tables right? (streets, cities, districts) and assign fk's to them and link those fk's to my __pkPropertyID? 

                         Would you create a window I described above the same way or would you do it differently?

                         Thanks Phil!

                    • 7. Re: validation = not empty
                      CekariYH
                           

                                Coming to think of what I learned in the past days, I think I should create three new tables right? (streets, cities, districts) and assign fk's to them and link those fk's to my __pkPropertyID?


                           Yes,. that's the way I would do it, one table for each.

                           Guessing here but assuming Districts are within City's.

                           In the layout (one for all 3 fields (and additional fields )) I would use a drop down-list (the one with an entry field) for each table so the user always is forced to choose a City in the list or enter a new City before being able to select the other two, then force to choose or enter a District and prevent the user from choosing the Street one and finally force the user to choose or add a new Street.

                            

                           Code: When the District or Street fields are selected.

                           When District field is selected (by tab-key, moseclick or whatever).
                            Chose an OnAktivationOfField" scrip-trigger sorry, don't have a name in english for triggers)
                           Scrip: name of your liking, ei Check District
                            If [isEmpty (CityTable::City-field)] "check if a City is choosen or entered"
                           Go to Field [CityTable::City-field]   "If no City, return to City field
                           end if

                            

                           When Street field is selected (by tab-key, mouse-click or whatever).
                            Chose an OnAktivationOfField" scrip-trigger sorry, don't have a name in English for triggers).
                           Scrip: Name of your liking ei Check City2Street
                            If [isEmpty (CityTable::City-field)] "check if a City is choosen or entered"
                             Go to Field [CityTable::City-field]   "If no City, return to City field
                           Elsif  [isEmpty (DistrictTable::District-field)] "check if a District  is choosen or entered"
                            Go to Field [DistrictTable::City-field]   "If no District, return to District field
                           Elsif  [Not isEmpty (CityTable::City-field)] and [Not isEmpty (DistrictTable::District-field)] force to choose or enter a Street if City and District are not empty.
                             Go to Field [StreetTable::Street-field] 
                           end if

                           Then if you choosed that these fields can't be empty where you create fields for the table the user will be return to the first field in the tab-order that is empty when committing the record (saving or anything that forces a commit.. Preferable the City field before the other two or any other field before these three if they are required as well and empty.

                      • 8. Re: validation = not empty
                        BorisKamp

                             Thanks CekariYH for you explanation!