SAP Knowledge Base Article - Public

3232497 - CMT : CPQ: How to write a tag that will compare two dates

Symptom

CPQ: How to write a tag that will compare two dates

Resolution

Applies To:  

CPQ

 

Summary:
This article will show you how to write a CPQ tag that will compare two dates within CPQ.


Details:
Currently, CPQ does not have tag operator to compare two dates. Using operator tags such as [GT] (Greater Than) or [LT] (Less Than) will only compare number and string values; therefore, will not work for dates.

 

Solution/Workaround:
The best optimal way to compare two dates in CPQ is to use a VBScript function, DateDiff, in a CPQ Eval Tag.

Correct tag to use is below:

<*Eval(DateDiff("interval","Date1","Date2"))*>

 

Return results of tag would be:

Positive Number = Number of day(s) from "Date1" to "Date2".

Negative Number= Number of day(s) after "Date1" to "Date2".

0 = Same dates are being compared.

Sample of what tag should look like:
E.g <*Eval(DateDiff("d","05/04/2014","04/04/2015"))*>

 

Comments:

  • The 'DateDiff' is Visual Basic Function. Click here to find more information about this function.
  • VB Function must be used inside of a CPQ Eval (<* Eval(...) *>) tag.

 

Keywords

KBA , CEC-SAL-CPQ , Sales Cloud CPQ , How To

Product

SAP CPQ all versions