6 Replies Latest reply on Jun 1, 2010 11:08 AM by philmodjunk

    Simple (probably) filemaker script to return true or false.

    Kristoffernolgren

      Title

      Simple (probably) filemaker script to return true or false.

      Post

      Pretty new to filemaker, would really appriciate some help :)

       

      I'm trying to create a script in filemaker that returns true if  table::field = 1 for a certain dataentry, and false in all other cases. How do I do this?

       

        • 1. Re: Simple (probably) filemaker script to return true or false.
          philmodjunk

          the expression you posted: table::Field = 1, will return True (1) if the field stores the number 1 and False ( 0 ) if it does not.

           

          You could use an if statement, If ( table::Field = 1 ; True ; False ), but this will give you exactly the same result from a more complicated expression.

          • 2. Re: Simple (probably) filemaker script to return true or false.
            Kristoffernolgren

            So, the good news is, I'm not a complet idiot.

             

            The bad news is it doesn't seem to work :P

             

            Context:

            The table i'm trying to "check" is a jointable called AssignmentTasks, it has three columns:

            AssignmentID, TaskID and Completed.

             

            Every time a new dataentry is created in the Assignment table, a data entry in the AssignmentTasks-table is created for each task. The completed is set to 0. I need to be able to see if a task is completed or not for various reasons (a "ToDo"-list for example) 

             

            For example:

            I try to use

            AssignmentsTasks::Completed = 0

            in order to change the textcolor using conditional formatting, but nothing happens. Previously I used this (working) code:

            not IsEmpty ( FilterValues ( Egenvärde ; List ( AssignmentsTasks::TaskID ) ) )

             

            Egenvärde is from the swedish version it translates to

            eigenvalue

            intrinsic value

            self-worth

            caracteristic value 

             

            back then, It was checking if there were any data-entries available at all in the join-table, whenever a assignmentID and TaskId was in the table the task was concidered done.

            • 3. Re: Simple (probably) filemaker script to return true or false.
              philmodjunk

              Context makes a difference here.

               

              My previous post was based on the assumption that the values being compared were all part of the same table. If you use an expression such as:

               

              RelatedTable::Field = 1

               

              From the context of your parent table, then you are checking only the first related record (the first row in your portal)--not all the records.

               

              The list function pulls all the related values into a return separated list, which is why it works.

               

              I don't see why your conditional format expression: AssignmentsTasks::Completed = 0 Doesn't work. If this is applied directly to a field from the AssignmentsTasks table, it should work.

              • 4. Re: Simple (probably) filemaker script to return true or false.
                Kristoffernolgren

                Oh, I see, sort of. The conditional formatting is in a portal... does that make any difference?

                • 5. Re: Simple (probably) filemaker script to return true or false.
                  Kristoffernolgren

                  Hrm I'm really close now. Everything accept the actual conditional formatting seems to be working. (I can check and uncheck all the boxes properly) and the completed field is changing accordingly.

                   

                  the conditional formatting however, seems to relate to the first dataentry for all the boxes (if i check the first box in the portal of all the boxes get checked, but if I check any of the other boxes, nothing happens!

                  • 6. Re: Simple (probably) filemaker script to return true or false.
                    philmodjunk

                    "if i check the first box in the portal of all the boxes get checked, but if I check any of the other boxes, nothing happens!"

                    I'm afraid you lot me there. What boxes are you talking about and what do they have to do with any conditional formatting (which changes text style, text color or fill color) have to do with this?