Using pipe "|" as a delimiter

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Using pipe "|" as a delimiter

Post by Simon » Tue Apr 07, 2015 12:13 pm

Hi Gang,
Recently I've hook up with a client that uses | as a delimiter. Sounds good to me (but I've always used tab).
Is it? Thoughts? (Richard) Gastology? :)

Simon
edited
Last edited by Simon on Tue Apr 07, 2015 1:07 pm, edited 1 time in total.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Using pipe "|" as a delimiter

Post by Klaus » Tue Apr 07, 2015 12:46 pm

Hi Simon,

I use whatever fits the situatiion as itemdel!
But what the egg is "Gastology"? All my dicitonaries failed here 8)


Best

Klaus

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Using pipe "|" as a delimiter

Post by Simon » Tue Apr 07, 2015 1:00 pm

Hi Klaus,
Richard Gaskin has strong thoughts on this.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Using pipe "|" as a delimiter

Post by Klaus » Tue Apr 07, 2015 1:51 pm

Simon wrote:Richard Gaskin has strong thoughts on this.
On Gastology? :D

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Using pipe "|" as a delimiter

Post by FourthWorld » Tue Apr 07, 2015 4:13 pm

That "CSV Must Die" article may be my worst bit of writing yet, since the headline makes it memorable but its details apparently less so. I'll see if I can clean that up a bit more, but in the here-and-now I had intended that it have two takeaways:

1. A delimiter character is useful in inverse proportion to the frequency with which it appears in content.
2. Postel's Law: "Be liberal in what you accept, and conservative in what you send."

We often have no control over the format of the data we're asked to work with. The options we may provide for export are a separate matter, and the last line of that article makes my opinion on commas clear enough. :) But for import. we need to write import filters for any data we want to work with. I provided a variant of the Tweedly LC algo for CSV in that article to help; few tabular formats other than CSV are complicated enough to need anything that cumbersome.

Many affiliate marketing networks (ShareASale, Commission Junction, etc.) provide product lists in pipe-delimited format, and when they do they avoid content that includes pipes, such as the trademark "c|net". Since my WebMerge product is popular among affiliate marketers I've had to work with pipe-delimited files extensively, and for affiliate product feeds I've not yet found one which included "|" among its data. If you're as lucky it's straightforward to just replace "|" with tab and you're done.

As long as you know the delimiter used will never appear in the content it doesn't matter much which delimiter you use. If you knew the letter "a" would never appear you could just as well use that, but that's even more common than commas, requiring us to get into the wacky world of escaping and escaping escapes that my article pokes fun at.

I tend to write import filters to deliver everything in a tab-delimited format for those cases where the data may be displayed in lists, since of course LC fields do a wonderful job of displaying multi-column data automatically when delimited by tabs.

But if you're just doing analytics on the data it may not even be worth the clock cycles to replace "|" with tab; you could just as easily set the itemDel to "|" and work with it directly.

All that said, if the client also insists on exporting in pipe-delimited format, it may be useful to note that any program that can parse pipes can parse tabs just as easily, but the reverse isn't always true, so the project would gain broader interoperability options by adopting the more common tab-delimited format.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Using pipe "|" as a delimiter

Post by Klaus » Tue Apr 07, 2015 5:35 pm

Aha, OK, now what about "Gastology"? :D

Post Reply