Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey everyone,
Im trying to create 2 text objects with 2 expressions.
1st. Count the amount of users of today (by using the Today() function).
2nd. Count the amount of users of yesterday (by using the Date(Today()-1) function).
For example:
If I look at the objects today (10-02-2017) I can see 5 users today and the text
object with the amount of users of yesterday shows 6.
Then if I look at the same objects the next day, I want to see the amount of users of that day (11-02-2017)
and the 5 users of yesterday (10-02-2017).
I hope someone can help me out with this problem
Thanks in advance,
Ivo
Within my suggestion is a small typo which needs to be corrected - the square bracket must be a curved bracket (which also caused the red-lines by the field User_ID from the syntax-checker):
count({< Date = {"$(=today())"}>} User)
count({< Date = {"$(=date(today()-1))"}>} User)
Beside this make sure that Date is really a date and not a timestamp - if it it needs to be cut with floor() - and that Date has the same formatting as your default date-formatting defined by the variables with which your script starts. If this format is different from Date you need to adjust either this variable or extend the date-function within the set analysis to your needed format, like: date(Date, 'YourDateFormat').
- Marcus
You could get it with:
count({< Date = {"$(=today())"}>] User)
count({< Date = {"$(=date(today()-1))"}>] User)
- Marcus
Hey Marcus,
Thanks for the reply, but both expressions give me a 0 count and I'm totally sure that the logfiles show use on today and yesterday. I also had a problem with the syntax when I copied your lines of expressions.
Note: I changed 'User' to 'User_ID', because that is how the User is defined in my tool.
Within my suggestion is a small typo which needs to be corrected - the square bracket must be a curved bracket (which also caused the red-lines by the field User_ID from the syntax-checker):
count({< Date = {"$(=today())"}>} User)
count({< Date = {"$(=date(today()-1))"}>} User)
Beside this make sure that Date is really a date and not a timestamp - if it it needs to be cut with floor() - and that Date has the same formatting as your default date-formatting defined by the variables with which your script starts. If this format is different from Date you need to adjust either this variable or extend the date-function within the set analysis to your needed format, like: date(Date, 'YourDateFormat').
- Marcus
This worked, Thanks!
It was indeed a problem with the timestamp. I changed the date field to a date field that had a normal notation instead of a timestamp notation.