8 Replies Latest reply on Mar 10, 2011 3:03 PM by Terri

    FM 101 - Why isn't this calculation working?

    Terri

      Title

      FM 101 - Why isn't this calculation working?

      Post

      I know this is probably going to be too little of information for you to help me, but at first glance, is there anything wrong with this calculation? Why isn't it working?

      Case ( Catalogs::Division = "Core"; Catalogs::Page Count * 395 ; Catalogs::Division = "Intl"; Catalogs::Page Count * 243; "")

      Thought I would give this a quick try before I get into a more complex explanation of what I want the formula to do.

       

      Thanks!

        • 1. Re: FM 101 - Why isn't this calculation working?
          philmodjunk

          Case ( Catalogs::Division = "Core"; Catalogs::Page Count * 395 ;
                    Catalogs::Division = "Intl"; Catalogs::Page Count * 243;
                    "")

          I see nothing wrong in the syntax of that function.

          • 2. Re: FM 101 - Why isn't this calculation working?
            Terri

            That's what I was afraid of, so it must have something to do with my relationship between the two tables. Any ideas? Obviously one table is called Catalogs, the other is Media.

            Check point, the field is set up as a calculation with display as number selected. So I think I'm ok in terms of the field set up. Next check point?

            • 3. Re: FM 101 - Why isn't this calculation working?
              philmodjunk

              I only see a reference to the Catalogs table in the expression.  How is Media related to Catalog? 

              Is this calculation field defined in media or calculation?

              How is this failing? Blank field? Wrong Value? Value doesn't update correctly?

              Is this a number field with the above expression entered as it's auto-enter calculation or is it a field of type calculation with Number specified as its return type?

              • 4. Re: FM 101 - Why isn't this calculation working?
                Terri

                To be more clear it is table Premedia (this was needed if you do look at the word doc). Can I send you a word doc?

                It is defined in Media.

                Blank

                Field of type calculation with Number specified as the return type.

                • 5. Re: FM 101 - Why isn't this calculation working?
                  philmodjunk

                  You can upload the doc to a file share site and post the download link here.

                  Why not define this in Catalog?

                  Defined in Media ( or Premedia ) this calculation will refer to the first related record in Catalog and will be an unstored calculation.

                  • 6. Re: FM 101 - Why isn't this calculation working?
                    Terri

                    I guess there isn't a good answer for that other than there are already 362 (yes 362) fields in catalogs. This information is being used by an entirely different department so I thought I would just create a separate table for them. Maybe that is doing it the hard way.

                    If I can't resolve this by tomorrow morning, I'll send through a share site.

                    Thanks!

                    • 7. Re: FM 101 - Why isn't this calculation working?
                      philmodjunk

                      Here's an example that may give you a clue as to why it's not working for you.

                      Say I have this data in table 1:

                      Type    Qty     Price
                      Apple    2        25
                      Kiwi       3        43
                      Apple    1        25
                      Grape    5        4

                      In table 2 have have a matching type field for this relationship:

                      Table 2::Type = Table 1::Type

                      If I define this calculation field in Table 2:
                      Qty * Price

                      And go to or create a record with Apple in the Table 2::Type field...

                      It will return a value of 50 and the second related record with Type Apple and a Qty of 1 will be ignored as the calculation will only refer to the first related record. (The "first related record" will be the first such record created unless a sort order is defined for the relationship. If there's a sort order specified, whatever record falls first in the relationship's sort order will be teh "first related record".)

                      • 8. Re: FM 101 - Why isn't this calculation working?
                        Terri

                        That was it Phil!! Thanks!