You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@unomi.apache.org by Michael Ghen <mi...@mikeghen.com> on 2018/12/01 05:42:40 UTC

Examples for Conditions based on Dates

Hello,

Does anyone have an example of a condition that uses date arithmetic? I was
wondering how to create a condition where a property of a client like
registeredDate is more than 3 days ago.

Let me know if anyone has an example they can share. I plan on digging more
into it tomorrow.

Re: Examples for Conditions based on Dates

Posted by Michael Ghen <mi...@mikeghen.com>.
Thanks, Serge! That's interesting syntax, I will give this a try. Will see
if I can share an example in the resources too once I get it working.

On Sun, Dec 2, 2018 at 3:30 AM Serge Huber <sh...@apache.org> wrote:

> Hello Michael,
>
> Here's an example from the newVisitorCondition, I hope it'll help :
>
> {
>   "metadata": {
>     "id": "newVisitorCondition",
>     "name": "newVisitorCondition",
>     "description": "",
>     "systemTags": [
>       "profileTags",
>       "event",
>       "condition",
>       "sessionCondition"
>     ],
>     "readOnly": true
>   },
>   "parentCondition": {
>     "type": "booleanCondition",
>     "parameterValues": {
>       "operator": "or",
>       "subConditions": [
>         {
>           "type": "sessionPropertyCondition",
>           "parameterValues": {
>             "propertyName": "profile.properties.previousVisit",
>             "comparisonOperator": "missing"
>           }
>         },
>         {
>           "type": "sessionPropertyCondition",
>           "parameterValues": {
>             "propertyName": "profile.properties.previousVisit",
>             "comparisonOperator": "lessThan",
>             "propertyValueDateExpr": "script::'now-'+since+'d'"
>           }
>         }
>       ]
>     }
>   },
>
>   "parameters": [
>     {
>       "id": "since",
>       "type": "integer",
>       "multivalued": false
>     }
>   ]
> }
>
> Regards,
>   Serge...
> On Sat, Dec 1, 2018 at 6:43 AM Michael Ghen <mi...@mikeghen.com> wrote:
> >
> > Hello,
> >
> > Does anyone have an example of a condition that uses date arithmetic? I
> was wondering how to create a condition where a property of a client like
> registeredDate is more than 3 days ago.
> >
> > Let me know if anyone has an example they can share. I plan on digging
> more into it tomorrow.
>

Re: Examples for Conditions based on Dates

Posted by Serge Huber <sh...@apache.org>.
Hello Michael,

Here's an example from the newVisitorCondition, I hope it'll help :

{
  "metadata": {
    "id": "newVisitorCondition",
    "name": "newVisitorCondition",
    "description": "",
    "systemTags": [
      "profileTags",
      "event",
      "condition",
      "sessionCondition"
    ],
    "readOnly": true
  },
  "parentCondition": {
    "type": "booleanCondition",
    "parameterValues": {
      "operator": "or",
      "subConditions": [
        {
          "type": "sessionPropertyCondition",
          "parameterValues": {
            "propertyName": "profile.properties.previousVisit",
            "comparisonOperator": "missing"
          }
        },
        {
          "type": "sessionPropertyCondition",
          "parameterValues": {
            "propertyName": "profile.properties.previousVisit",
            "comparisonOperator": "lessThan",
            "propertyValueDateExpr": "script::'now-'+since+'d'"
          }
        }
      ]
    }
  },

  "parameters": [
    {
      "id": "since",
      "type": "integer",
      "multivalued": false
    }
  ]
}

Regards,
  Serge...
On Sat, Dec 1, 2018 at 6:43 AM Michael Ghen <mi...@mikeghen.com> wrote:
>
> Hello,
>
> Does anyone have an example of a condition that uses date arithmetic? I was wondering how to create a condition where a property of a client like registeredDate is more than 3 days ago.
>
> Let me know if anyone has an example they can share. I plan on digging more into it tomorrow.