glenhest53 Posted January 12, 2006 Posted January 12, 2006 (edited) I am really stumped on how to write a script to do this or even if it is possible to do. Please note that the only funtion this layout has is to provide a tab-delimited text file to automate data publishing in Adobe Indesign. I have an employee database with a field "Department" It contains various Department names. See Employees.fp7 So I was thinking of a script that loops and adds a new record each time the "Department" field changes and puts the loop number into the "PositonNumber" field and the Department name in the "DepartmentBanner" field then finally ends up sorted by "PositionNumber" ascending. See Picture 3.pdf Picture_3.pdf Employees.fp7.zip Edited January 12, 2006 by Guest
sbg2 Posted January 12, 2006 Posted January 12, 2006 I have attached an example that just builds what you want to export into a global Text field called g_DepartmentExport. I also added g_CurrentPoistion (obvious) and g_CurrentDeptBan (hopefully also obvious). Just in case I didn't make it obvious in the script you can insert a Tab in FileMaker by pressing ctrl+tab. I probably wasn't as wordy as I could have been with the Comments in the script but ask questions if you have any. After it builds the text field it is set to Export Field Contents and will ask you to specify where to export to, pick a destination and save the file. Try an import into Indesign, if you encounter problems you will have to add a few more steps to the script. Employees.zip
glenhest53 Posted January 12, 2006 Author Posted January 12, 2006 Wow! Thanks for your work on this. The text file is exactly what I need for a data import into Indesign. I will have to test that part with Applescript tomorrow.
glenhest53 Posted January 13, 2006 Author Posted January 13, 2006 Thanks for your help sbg2: I now have a need to pad the text file if the Department Banner falls at the end of a row in InDesign. In other words if it falls at 4 or any multiple of 4. I have duplicated your script (See script "ExportDepartment-PlugAt4" in attached file.) and added some conditionals that allows for for 4 or 8. My question is: How do I create a calculation within the conditional statment in the script to allow for 4 or multiples of 4 without having to write a whole list of if statements. Employees3.fp7.zip
sbg2 Posted January 13, 2006 Posted January 13, 2006 If [Mod(g_CurrentPosition;4) = 0] Mod returns the remainder after dividing two numbers, in this case g_CurrentPosition divided by 4. If your Position is a multiple of 4 their will be no remaider.
glenhest53 Posted January 13, 2006 Author Posted January 13, 2006 (edited) Thanks so much! This, as usual on this forum, has been a real good learning experience. Edited January 13, 2006 by Guest
Recommended Posts
This topic is 6891 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now