Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Batch export script

Featured Replies

I need a script that will export multiple records to .tab files without me having to manually export each record.

How do I do this? Help!

If each record needs to be a separate .tab file, then loop through the found set.

  • Author

Yes, I know that. I just don't how to write the script properly. I am not a programming genius. I tried writing a script, but it just put everything into one file.

Is there a basic script that will loop through a found set that I can modify????

Remeber Export Record will export the found set

set variable ($count;value:0)

loop

set variable ($count;value:$count +1)

perform find() /* value + count.. or record id.. you need to set up and Id on each record or a count....

export records($variable here)

end loop if($count > $count > Get ( TotalRecordCount ))

  • Author

What do you mean by "you need to set up and Id on each record or a count..."?

I have two fields. TEAMID and PFACODE.

I want to output a file for each TEAMID that lists all the lines/records/rows (whatever you want to call them) of the PFACODE.

Also, how do I name each record using the TEAMID & .tab?

Ughhh!

This part is not quite clear:

I want to output a file for each TEAMID that lists all the lines/records/rows (whatever you want to call them) of the PFACODE.

If PFACODE is a field, then it cannot contain records. Perhaps you meant to say it contains multiple values - but if you export a single record in a tab format, the separate values in a field will NOT be tab-delimited.

---

Besides, if your field contains multiple values that need to be exported as separate lines/records/rows, you may want to re-examine your structure and turn them into separate records in a related table.

Edited by comment

  • Author

Ok, yes, I meant values not records. Ok, if I turn them into related tables, then is there a script that will export them in the manner that want the to be exported??????????????

Well, there are two ways: first, even with your current structure you could export each record in turn by using the Export Field Contents [] script step, using a calculation field to substitute the returns with tabs. However, the resulting file will be UTF-16 encoded, and not all target applications can handle that.

The other option is to export as XML, using a custom XSLT stylesheet to build the exported file to your specifications.

export as XML (with XSLT) will not allow you to create multiple files upon output, if that's your goal.

Are you trying to get separate files (one per found record)?

export as XML (with XSLT) will not allow you to create multiple files upon output

No, of course not; you still have to loop through the found set and export each group of values in turn. I should have made that clear. Still, if your target application won't accept a UTF-16 encoded file, it's the only practical way to place tabs between the exported values.

@TMaher1

I'd like to take back my first response. I'd rather ask you, "why?" Is this for import into another system?

  • Author

Because the PFACODE contains HTML code. I'm trying to create web pages for each find of TEAMID and all the PFACODE values related to TEAMID. No, I don't want to use FM server. Again, is their some script that can "automate" will repeat the export of each related record without me having to it manually one at a time??????????????????????????????

I have already mentioned two ways to do it. If you have said 'No, my target app cannot handle a UTF-16 encoded file" or "Yes, there is no problem with a UTF-16 file", we could concentrate on one of them.

PFACODE contains HTML code

Well, that's new. Why, then, is it important for the values to be tab-separated?

  • 3 weeks later...
  • Author

I have already mentioned two ways to do it. If you have said 'No, my target app cannot handle a UTF-16 encoded file" or "Yes, there is no problem with a UTF-16 file", we could concentrate on one of them.

Well, that's new. Why, then, is it important for the values to be tab-separated?

Ok, I'll change the output to .html. Geesh.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.