January 12, 200620 yr 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, 200620 yr by Guest
January 12, 200620 yr 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
January 12, 200620 yr Author 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.
January 13, 200620 yr Author 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
January 13, 200620 yr 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.
January 13, 200620 yr Author Thanks so much! This, as usual on this forum, has been a real good learning experience. Edited January 13, 200620 yr by Guest
Create an account or sign in to comment