Can someone give me some advice? I have done set-up print merge document that contains an address which is made up of different fields - apartment number, streete address, city, etc. This document will have personal information from 900 people merged into it - each person will receive the page that has all of their information on it. Not everyone has an apartment no, therefore, I want to set a condition that if here is an apartment no., a dash will be added between the apartment no. field and the address field.
Do this in Excel or another spreadsheet before importing the data merge file into InDesign.
InDesign has no concept of conditional data merge and if you tried to implement something like that in ExtendScript you would be wasting a lot of time -- just use a spreadsheet (or database).