7 Replies Latest reply on Oct 16, 2013 3:23 PM by philmodjunk

    If a condition is met the field content appears...if not, no field contents are inserted

    EllieGutierrez

      Title

      If a condition is met the field content appears...if not, no field contents are inserted

      Post

           Hello,

           I would like a script which inserts field contents that meet a certain criteria or otherwise is blank.

           We have student records that are related to other student records in our system.  The related records could be for a past closed record for the student, or a sibling.  The related record will  have a variety of status codes (e.g. withdrawn, enrolled, closed, graduates...etc.).  What I would like to happen is that only records with the status of "enrolled" show in the result field. On the image below the field is the "inq_ING_All_Siblings".  

      Sibling_list.jpg

        • 1. Re: If a condition is met the field content appears...if not, no field contents are inserted
          philmodjunk

               Please copy and paste the portal filter that you have specified into your next post to this thread. It should be possible to set up that filter expression to limit the related records in the portal to just those that have a status of "enrolled".

               PS. This has nothing to do with "scripting". It's all a matter of setting up the correct relationship and portal filter.

          • 2. Re: If a condition is met the field content appears...if not, no field contents are inserted
            EllieGutierrez

                 Hi again Phil,

                 There was no filter in place.  I am guessing that is why any and all status were showing up.  I cut and pasted a script I thought would work into the scripting area but it did not work (that is why the filter box was checked in the previous image).  Below is what appears when the "Filter Portal Records" box is checked and the incorrect script is removed.  

            • 3. Re: If a condition is met the field content appears...if not, no field contents are inserted
              philmodjunk
                   

                         I cut and pasted a script I thought would work into the scripting area but it did not work

                   There is no "scripting area" here. I think that you mean that you pasted into the specify calculation dialog. (Scripting is done via Manage | Scripts and that's not what you are dealing with here. wink)

                   I'm guessing here as to field names, but the following expression should filter the portal as you have requested provided you use your field name and status field value instead of what I am using in this example:

                   inq_INQ All Siblings::Status = "enrolled"

                   This assumes that the status field is named status, it's of type text (or a calculation that returns text) and that the literal text "enrolled" is found in that field when that record has the status of "enrolled".

                    

              • 4. Re: If a condition is met the field content appears...if not, no field contents are inserted
                EllieGutierrez

                     Phil,

                     If it looks like a script and acts like a script that calcuates...so...

                     I changed your solution to: inq_INQ All Siblings::Adm_enr_status = "Enrolled"

                     It still did not work.

                     So here is more information that might influence the outcome:  The database that the list  and core information is coming out of is different than the "inq_ING All Sibling" database.  The inq_INQ database is populated by the core database's fields.  Also, on the image,  I noticed that below the specify calculation dialog box it indicates that the result must be boolean and true or false.  

                      

                      

                      

                      

                • 5. Re: If a condition is met the field content appears...if not, no field contents are inserted
                  philmodjunk

                       But it does not "act like a script" and using script when you mean something else can lead to confusion on the part of others reading this thread.

                       

                            It still did not work.

                       make sure that Adm_enr_status has the exact value "enrolled" when the status is enrolled. Even an invisible character such as a return or space will keep this from working. So will it be if this field stores multiple values such as is produced when you format a field with multiple check boxes.

                       Make sure that the field is of type text and not number.

                       

                            So here is more information...

                       I can't really follow all of that--it's just too vague and I think you mean "table" when you say "database". I may sound picky but misunderstandings are so easy... I doubt that any of that will have any effect on why this is or isn't working so long as the Adm_enr_status has the correct data and is defined with the correct data type.

                       

                             I noticed that below the specify calculation dialog box it indicates that the result must be boolean and true or false.

                  inq_INQ All Siblings::Adm_enr_status = "Enrolled"

                       is a boolean expression. It will evaluate to True if the value in the field is "Enrolled". It will evaluate to False if it does not. This expression is applied to every related record and only those for which the result is true are shown in the portal.

                        

                  • 6. Re: If a condition is met the field content appears...if not, no field contents are inserted
                    EllieGutierrez

                    Phil,

                          
                         Okay, okay....I was just sayin'!  
                          
                         Anyway...I tried it again...no luck!    I was looking at the manage database section and saw that the "Enrolled" is a placeholder for "isenrolled" , maybe a true/false field.  Does that change anything?
                    • 7. Re: If a condition is met the field content appears...if not, no field contents are inserted
                      philmodjunk

                           It's hard to say. "enrolled" in our example is literal text in quotes. It does not refer to anything in Manage Database. So I have no idea what a field named isenrolled has to do with this.

                           we've been using an expression that compares Siblings::Adm_enr_status to that literal text "enrolled"

                           You'd get an error message if that field did not exist.

                           isenrolled does sound like a field that would store a Boolean value. In FileMaker a field of type NUMBER not TEXT is usually used for that with the number 1 entered to store "True" in that field, but you'd have to check the field's data type in Manage | Database | Fields to know if that is the case.

                           Then you'll have to explain the connection between Siblings::Adm_enr_status and "isenrolled".