0

我正在为根据条件进行多次计算的佣金字段创建公式。我目前收到一条错误消息(错误:函数'AND()'的参数类型不正确。预期的布尔值,收到的数字)。我应该如何修改公式来解决这个问题?

IF(AND(Order__r.New_Amount_Outstanding__c = 0,Order__r.RecordTypeId="Bespoke Item",ISPICKVAL( Payment_type__c , 'Deposit'), Date__c >= DATE(2017,04,01)),(Order__r.Amount_RollUp__c) *1.2/100 ,IF(AND(Order__r.RecordTypeId="Bespoke Item",ISPICKVAL( Payment_type__c , 'Deposit'), Date__c < DATE(2017,04,01),(Order__r.New_New_Net__c) *1.2/100),IF(Order__r.RecordTypeId <>"定制项目",(Order__r.New_New_Net__c *1.2/100), NULL)))

它基本上由 3 个场景组成:

IF(AND(Order__r.New_Amount_Outstanding__c = 0,Order__r.RecordTypeId="Bespoke Item",ISPICKVAL( Payment_type__c , 'Deposit'), Date__c >= DATE(2017,04,01)),(Order__r.Amount_RollUp__c) *1.2/100 ,

IF(AND(Order__r.RecordTypeId="Bespoke Item",ISPICKVAL( Payment_type__c , 'Deposit'), Date__c < DATE(2017,04,01),(Order__r.New_New_Net__c) *1.2/100),

IF(Order__r.RecordTypeId<>"定制项目",(Order__r.New_New_Net__c *1.2/100),

无效的)))

4

1 回答 1

1

你有一个放错位置的“)”。当你缩进公式时,它变得很明显:

IF(
  AND(
    Order__r.New_Amount_Outstanding__c = 0,
    Order__r.RecordTypeId="Bespoke Item",
    ISPICKVAL( Payment_type__c , 'Deposit'), 
    Date__c >= DATE(2017,04,01)
  ),
  (Order__r.Amount_RollUp__c) *1.2/100,
  IF(
    AND(
      Order__r.RecordTypeId="Bespoke Item",
      ISPICKVAL( Payment_type__c , 'Deposit'), 
      Date__c < DATE(2017,04,01),
      (Order__r.New_New_Net__c) *1.2/100),
      IF(Order__r.RecordTypeId<>"Bespoke Item",
        (Order__r.New_New_Net__*1.2/100), 
        NULL
      )
   )
)

应该:

IF(
  /*Test this Argument*/
  AND(
    Order__r.New_Amount_Outstanding__c = 0,
    Order__r.RecordTypeId="Bespoke Item",
    ISPICKVAL( Payment_type__c , 'Deposit'), 
    Date__c >= DATE(2017,04,01)
  ),
  /* If True */
  (Order__r.Amount_RollUp__c) *1.2/100,
  /* If False */
  IF(
    /* Test this Argument */
    AND(
      Order__r.RecordTypeId="Bespoke Item",
      ISPICKVAL( Payment_type__c , 'Deposit'), 
      Date__c < DATE(2017,04,01)
    ),
    /* If True */
    (Order__r.New_New_Net__c) *1.2/100),
    /* If False*/
    IF(
       /* Test this Argument */
       Order__r.RecordTypeId<>"Bespoke Item",
       /* If True */
       (Order__r.New_New_Net__*1.2/100), 
       /* If False */
       NULL
    )
  )
)

Order__r.RecordTypeId="Bespoke Item" 还会评估为 TRUE 吗?我认为这将是一个ID。

于 2018-01-05T02:30:31.133 回答