Skip to main content
Participant
September 27, 2023
Question

Browse all preview from data merge in script

  • September 27, 2023
  • 1 reply
  • 400 views

Hello,

 

How can we browse in JavaScript all the data merge previews?

 

I can't find any help on the internet, please help me.

 

Thank you for your help.

 
This topic has been closed for replies.

1 reply

brian_p_dts
Community Expert
Community Expert
September 27, 2023

That functionality is not exposed in scripting. What exactly are you hoping to accomplish by doing so?

Participant
September 27, 2023

After merging the data, I want to be able to set conditions on the preview. In other words, for each preview, I want to be able to delete fields if certain fields are set to 0. I can do this on the doc.activeDocument, but I need to apply my script to each preview and not to the active document.

Example:
preview 1
test: 12
test2 : 0
in this preview, I want the test2 field to be deleted

preview 2
test : 0
test2 : 498499
I want the test field to be deleted in this preview

So I want a code that applies to each preview separately.

Currently, if I run my script in preview 1, it will delete test2 (correct operation) but then in preview2, test2 will also be deleted (operation I don't want).

brian_p_dts
Community Expert
Community Expert
September 27, 2023

You would need to write the logic to operate on a completely merged document. I usually do this by naming the variable fields in the layers panel and iterating through a merged document to operate on them.