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.

Parsing a variable field

Featured Replies

I have a data parsing challenge with a CSV file of web orders I download from our website. Each order comes through as one record with fields for name, shipping address etc.. Then there is one field that contains ALL the ordered items. This could be one item or 10 items. I now need to create a script to parse this into separate records. So if for instance someone ordered 4 items, the script needs to create 4 new records and in each insert the data from one of the ordered items into several fields.

This is how the data arrives in one field. You can see the delimiters "|" separate "fields within the field" and "~" defines a "new record within the field".

1|SKU1|$14.50|1|Name1~2|SKU2|$9.95|1|Name 2~3|SKU3|$29.95|1|Name 3~4|TSKU4|$129.95|1|Name 4

So from this data, I need to create the following in 4 different records (where the | actually means it is a different field).

1|SKU1|$14.50|1|Name1

2|SKU2|$9.95|1|Name 2

3|SKU3|$29.95|1|Name 3

4|TSKU4|$129.95|1|Name 4

So where do I start with such a situation?

Run your import though a text editor such as TextWrangler (Free from Barebones Software, or BBEdit, also from Barebones. Just do a Replace All for | with t, and ~ with r, and then import the file.

Edited by Guest

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.