2 Replies Latest reply on May 28, 2017 8:42 AM by askewd

    Repeating Field Problem

    askewd

      Hey guys!   I'm doing a few practice tests just to help me practice programming in filemaker.  Nothing too complex at the moment.  I've run into a puzzle today that i just can't solve, i know it should be simple -  it's bugging me now :-)    Would love to know what i'm doing wrong.   

      (Also ,i realise that repeating fields are not the recommended way of doing things in FM so please don't tell me off.)

       

      OK: 

       

      - i have a single field called "Price" which is a number .   (although it doesn't matter really what this field is, could be the word "Hello")

      - I have a "Writer Role" field that is a repeating field with 8 repeating fields.   In each one a role is assigned by the user. 

      - I also have an "Amount"  calculation field that looks to see what kind of Writer Role is in the associated repeating field,  and works out the 'amount' accordingly.   (again the details of this is kinda irrelevant and isn't reflected in my code below - i've used fixed values for simplicity)

       

      the code is:

       

      Let (

       

        Current = Get(CalculationRepetitionNumber);

       

        Case (

       

          WriterRole[Current] = "Writer" ; 999;

          WriterRole[Current] = "Producer" ; 888;

          WriterRole[Current] = "Vocalist" ; 777;

          WriterRole[Current] = "Writer & Vocalist" ; Price;

       

          Current

       

          ) // end Case

      ) // end Let

       

      So, when in browse mode this should put the repeating field number (Current) in each of the repeating field slots  (IT DOES)

       

      When the WriterRole[Current] contains "Producer" it will show "888" as the answer instead  (IT DOES)  

       

      so far so good.

       

      The problem is that it refuses to show the "Price" variable.    Or any other variable or field.     I've even tried using  "get field" etc to define the variable first.

       

      So basically,  when i use a fixed value like "Hello"  it works fine!  but if i  had "Hello" in a FIELD and then referenced that field , it doesn't work! 

       

      I should mention that it does read it - but it always places the result it in the 1st repeating field.  Not the [current] one.

       

      What am i doing wrong?

       

      Thank you!

      Dale