Page 1 of 1

How to display all emailadress which has open within x days

Posted: Mon Mar 16, 2015 8:20 pm
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!

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

Posted: Wed Mar 18, 2015 5:46 pm
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.

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

Posted: Thu Aug 06, 2015 9:28 am
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.

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

Posted: Thu Aug 06, 2015 12:45 pm
by maschoff
Please have a look at the user manual.

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

Posted: Sat Aug 08, 2015 12:20 pm
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!

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

Posted: Sat Aug 08, 2015 3:42 pm
by maschoff
I do not see a parameter "zeit" in your example. BTW, do you have read the script action documentation?

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

Posted: Sat Aug 08, 2015 7:58 pm
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.

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

Posted: Sat Aug 08, 2015 8:19 pm
by maschoff
The $ is a part of Velocity. This is a Velocity script, using java methods and objects of OpenEMM.

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

Posted: Tue Aug 11, 2015 1:03 pm
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!

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

Posted: Tue Aug 11, 2015 1:49 pm
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.