OL Learn

Export script in the designer


I’m using the export script from this topic: Export a file

Is there anyway this script can be triggered in the designer?
It says “openTextWriter” is not devined.
I think the designer don’t support all the same functions as the workflow.

Is there a workaround tot trigger an export to .txt, .js or .csv from the designer?

Some objects and methods are only available in some modules, where they are appropriate. The ability to export your data records to CSV only makes sense in the context of a DataMapper’s post-processing script, after you’ve extracted all your records.

In the Designer, you only have access to a single record at a time. Exporting one record at a time would be fairly inefficient.

Maybe you could provide a little more background information on what you’re trying to achieve and I’m sure we can come up with some alternatives.

I’m working with large data-files and I try to get some insight in the realtime progress of the process. With in the datamapper I have used if statements to export a small js at 25%, 50% and 75%. This js is linked to a central html file so me and my team can get some insight in the progress.

The problem is, doing this in the datamapper doesn’t really give me any insight of the progress of the process, only in the progress of the datamapping. The datamapping often finished much quicker than the designer, job and output. So if I could do the same through the designer, i would give me a better insight of the progress.

I see. For this kind of use, I would recommend that you implement an AJAX call from both the Designer and the DataMapper, pointing to a Workflow process. You would send progress data through a very simple URL, like in the following examples:“DataMapper”&completion=“50”“DataMapper”&completion=“100”“Merging”&completion=“25”“Merging”&completion=“50”

Obviously, you could add other pertinent parameters in there, like a timestamp, the name of the Template, etc.

Your Workflow process would be very simple: receive the data through a NodeJS Server Input and, depending on the value of the module parameter, write the completion value to the appropriate file.

There are three main advantages of doing things this way:

  • The DataMapper and the Content Creation engines no longer have to write files, which can have an impact on performance. Instead, creating and writing files is the responsibility of Workflow, which can be located on the same system or a different machine altogether.
  • Using AJAX requests can be done asynchronously: you just send the request without waiting for an answer. This again eliminates any potential latency while you’re actually processing the jobs.
  • It centralizes the progress monitoring inside a Workflow process. You can simply add AJAX calls to any template and/or data mapping config and that’s it: you can monitor their progress.

Hope that helps,

1 Like

Thank you very much, I’m gonna try it out!