3 Replies Latest reply on Dec 12, 2011 12:10 PM by revmk

    novice needs help doing  if statements



      novice needs help doing  if statements


      Hi, I'm working on a wargaming Damage tracker in filemaker and i'm getting caught up in a test problem


      so far i have If ( SP Test <1; T. Armor; T. Armor - Total hits) which works fine, when the  fields are above 1, and returns the current remaining armor

      but i need it to show the remaining armor at all times and not just the initial armor


      what fields should i add or commands should i invoke?


      for example, when the test  result is 0, it should have saved the previous level of damage


      am i just needing an extra field to check this?

      or can a nested test fix this?

        • 1. Re: novice needs help doing  if statements

          Hello Yibber,

          I'm slightly confused so I may have missed the point.  You say you want to remember the previous damage.  At the moment you are calculating a field.  Depending on how and when you are doing this you may or may not be saving the result.  So with this in mind...

          How about having a separate field for which you add to each time damage is taken.  Define a field as 'accumulated damage' (integer - perhaps with decimal places?!).  When you calculate the damage taken add the value to this field.  You will then have the total damage stored in a field.  You can then add this into your calculation above as appropriate.

          If you wanted to be really clever you could have a separate table showing the damage 'as it happened'.  A nice little related table would enable you to input the differing war game 'rounds' values.  This would give you the chance to then look back on what has happened.  Depending on your needs you could make it as complex (read as clever/cool/interesting) as you wished - for example working new strategies and deciding what to do next.

          If you need any help it might help if you can post an example of your work.


          • 2. Re: novice needs help doing  if statements

            I see, so I need to create a new cell for this, did see this was coming.

            so Given that : how would i write the function?



            As for related tables, I knew how to do this in bento, but how would it work in filemake

            As it is, I've just been creating the cells for Every possible condition

            • 3. Re: novice needs help doing  if statements


              So lets take the first option of adding to a field each time.  

              You need to decide when you are going to update this value.  Are you clicking a button?  If so you could add somecode into the button press which might look like (forgive me Filemaker is not installed here):

              Set field value ['accumulated damage'] as calculation ['accumulated damage'+total hits].