I am trying to get count of record from a view for a date range example count of a column value for last 6 months on some condition. Can we use sql function DATEADD to get the daterange in the query.
Here is my Optic API query where I tried to use the DATEADD which gives me error:
xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic" at "/MarkLogic/optic.xqy";
op:from-view("GTM2_Shipment", "Shipment_View", "")
=> op:where( op:and(( op:eq(op:col('transMode'), 'Rail') , op:sql-condition("dateadd(month,-6,'BookingCreateDt')") )) )
=> op:group-by((), op:count(op:col("Rail_AncillaryCost"), op:col("Ancillary_QuotePrice")))
=> op:result()
Error:
OPTIC-INVALARGS: (err:FOER0000) Invalid arguments: map argument is not an expression
Please let me know what is the issue.