How to display all emailadress which has open within x days

Use this forum for questions regarding adoption and functionality of OpenEMM

Moderator: moderator

dreamy
Posts: 19
Joined: Sat Aug 18, 2012 8:18 pm

How to display all emailadress which has open within x days

Post by dreamy »

Hello,

is there a way to display all emailadresses which has open a newsletter within x days (lets say the last 14 days)?

Thanks!
maschoff
Site Admin
Posts: 2596
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: How to display all emailadress which has open within x d

Post by maschoff »

You could define an open action which sets a profile field in the recipient's profile to the current timestamp. Based on this profile field you could create a target group to filter the wanted recipients.
OpenEMM Maintainer
dreamy
Posts: 19
Joined: Sat Aug 18, 2012 8:18 pm

Re: How to display all emailadress which has open within x d

Post by dreamy »

Thank you for your answere. Could you please tell me how I set the current timestamp? I have added an action to modify the field. In the drop down menu there are +, - and = and a text Box. I habe tried to insert [agnDATE], but this won't work.
maschoff
Site Admin
Posts: 2596
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: How to display all emailadress which has open within x d

Post by maschoff »

Please have a look at the user manual.
OpenEMM Maintainer
dreamy
Posts: 19
Joined: Sat Aug 18, 2012 8:18 pm

Re: How to display all emailadress which has open within x d

Post by dreamy »

Hello,

thanks, but I still have problems. I like to write an own action script which set my field to current time. So I found this http://forum.openemm.org/using-openemm- ... c2483.html and tried to change it.

My code:

Code: Select all

$ScriptHelper.println("---------------START----------------")

$Customer.resetCustParameters()
$Customer.setCustomerID($customerID)
$Customer.setCompanyID(1)

$Customer.loadCustDBStructure()
##$Customer.loadAllBindings()
#set($parametros=$Customer.getCustomerDataFromDb())

## For each parameter we want to update a line like this:
set($parametros.zuletzt_aktiv=$requestParameters.zuletzt_aktiv)

## Timestamping
#java.util.Date date = new java.util.Date()

long zeit = date.getTime();
$ScriptHelper.println(zeit)

$requestParameters.put("zuletzt_aktiv", zeit)
$ScriptHelper.println($parametros.zuletzt_aktiv.toString())

#if($Customer.importRequestParameters($parametros, null))
    $ScriptHelper.println("parametros SUCCESS")
#else
    $ScriptHelper.println("parametros FALSE")
#end

$ScriptHelper.println("$CustomerID | 1 | $parametros")
$ScriptHelper.println("changeFlag: $Customer.changeFlag")
#set($Customer.changeFlag = true)

#if($Customer.updateInDB())
    $ScriptHelper.println("Customer update SUCCESS")
    $ScriptHelper.println($Customer.zuletzt_aktiv.toString())
#else
    $ScriptHelper.println("Customer update FALSE")
    $ScriptHelper.println($Customer.getCustomerDataFromDb().zuletzt_aktiv)
#end

$ScriptHelper.println($Customer.getCustomerDataFromDb().zuletzt_aktiv)

$ScriptHelper.println("-----END------")

#set($scriptResult="1")
But zeit is empty. Could you give me an advise?

Thanks!
maschoff
Site Admin
Posts: 2596
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: How to display all emailadress which has open within x d

Post by maschoff »

I do not see a parameter "zeit" in your example. BTW, do you have read the script action documentation?
OpenEMM Maintainer
dreamy
Posts: 19
Joined: Sat Aug 18, 2012 8:18 pm

Re: How to display all emailadress which has open within x d

Post by dreamy »

If you mean "OpenEMM-ScriptActions_Documentation_1.7.pdf", yes, or is there an other document?

Code: Select all

long zeit = date.getTime();
Did not this mean to store the date in a variable "zeit" of type long? I am not firm with Java, mostly I coding PHP so I am a littlebit confused with the "$" in the examples, but those code samples of Java I have read looks like type var_name = "some thing";

The ";" is an other point I am wondering. As I thought all lines should end with a ";" like in C/C++, PHP and other languages with has there origin in C.
maschoff
Site Admin
Posts: 2596
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: How to display all emailadress which has open within x d

Post by maschoff »

The $ is a part of Velocity. This is a Velocity script, using java methods and objects of OpenEMM.
OpenEMM Maintainer
dreamy
Posts: 19
Joined: Sat Aug 18, 2012 8:18 pm

Re: How to display all emailadress which has open within x d

Post by dreamy »

Thanks, could you please tell me whether the DateTool is installed or not.

I have tried:

Code: Select all

$ScriptHelper.println("Today: $date")
Prints: Today: $date


In your action script doc you use:

Code: Select all

$BindingEntry.setChangeDate(java.util.Date date)
java.util.Date date should give back the time stamp, but if I try to set up a var it stops at java an result an error. Is this not possible?

Thanks!
maschoff
Site Admin
Posts: 2596
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: How to display all emailadress which has open within x d

Post by maschoff »

The expression "java.util.Date date" in the doc is written in italics. This means that it is a placeholder to be replaced by an object of the specified type.
OpenEMM Maintainer
Post Reply