1 Reply Latest reply on Oct 30, 2014 3:37 PM by philmodjunk

    case calculation to determine dates based on text

    AdamReed

      Title

      case calculation to determine dates based on text

      Post

      I'm trying to create a calculated date field which is the date a particular payment is due.  That date is determined by the type of payment (text), for instance, a payment due "upon signature of a contract" is therefore due on whatever the DATE the contract is.  A payment due "upon delivery of a book" is due on the date on which the book is to be delivered.  So users will indicate things like "Advance on Signature" or "Advance on Delivery" and I'd like to calculate the due date based on the dates associated with the particular type of payment.  I've tried:

      Case ( 
      payment type = "Advance on Signature" ; contract::date of contract ; 
      payment type = "Advance on Delivery and Acceptance" ; book contract link::delivery date ; 
      "" )

      I don't get any errors doing this, but the field displays nothing.  Any ideas?

      Thanks very much,

      Adam

        • 1. Re: case calculation to determine dates based on text
          philmodjunk

          The basic syntax of your case function is correct. So if your results are not what you expect, you need to check two things:

          The values and data types of your fields.

          The context in which the function evaluates.

          If payment type is not a text field or the text in payment type is not exactly "Advance on Signature", it can't return the value of date of contract. That's an example of checking values and data types.

          but I also see that one expression refers to a table occurrence named "Contract" and another refers to a table occurrence named "book contract link". You may need to pay attention to the "context table (occurrence)" selected at the top of the specify calculation dialog and from there check the relationships linking the calculation field's table occurrence (as specified in the context drop down) to the other two occurrences used in the calculation.