7 Replies Latest reply on Apr 27, 2014 3:19 PM by madmike6537

    Calculation to get data from a specific related field

    madmike6537

      Hello there,

       

      I am trying to create a calculation that will get data from a specific table::field, and use that data for my caculation result.

       

      Basically, I am billing for customer equipment, but I want to bill not only for the cost of the equipment, but times how many days its been there. So I have a billing line item record - and I have a related peice of customer equipment:

       

      Billing_Line_Item::Equipment_KF >----- Customer_Equipment::KP

       

      Inside of the Customer_Equipment table is a field called number of days (the number of days the equipment was at the customer's location). I want to get that data, and multiply it times my billing item cost.

       

      First I thought I could just do this:

       

      Total =

      Billing_Line_Item::Cost * Customer_Equipment::Num_Of_Days

       

      But it turns out, that when you do this (from what I read), it just grabs the first record in that table, not a specifically related record. But I have both the record number of the equipment, as well as the primary key, so now I am trying to do this:

       

      Total =

      Billing_Line_Item::Cost * (GetNthRecord(Customer_Equipment::Days_At_Location; record#here))

       

       

      But its not working.

       

      What am I missing? Thanks and I hope that wasnt too confusing...