We're currently using Server Side JavaScript to access Data Extensions, but the performance here is abysmal (often over a second for a single row). So we tried accessing the Data Extensions via AMPscript and that seems to speed up the access by factor 100.
But we now have the problem that we need to get the data we retrieved in AMPscript over to JavaScript and so far we couldn't figure out an easy way to access the rowsets in JavaScript. Is this possible at all? I was hoping that it's just the same Object that we would get from DataExtension.Rows.Retrieve()
in SSJS, but that's not the case. If we dump the result from DataExtension.Rows.Retrieve()
it's a JSON array containing the keys and values per row. If we dump the object we retrieved in AMPscript we get System.Data.DataRow[]
which seems to be a .NET class.
The only way we got it working so far was looping over the rowset in AMPscript and building a JSON string here that we then parse with eval()
in SSJS. Is there a more convenient way?
So, basically what we're looking for is a way to have the same result as
var dataExtension = DataExtension.Init('DataExtensionName');
var result = dataExtension.Rows.Retrieve();
by using AMPscript to retrieve the data and handing it over to SSJS.