Skip to main content
Participating Frequently
December 11, 2008
Question

String Data Compression

  • December 11, 2008
  • 8 replies
  • 951 views
Is there a way to take a long string and compress it into a much shorter string?

Here's an example string, a comma-delimited set of values:

cd,1111-1111-11-1,d120700000a72cbj001c,46808598,60,1,030308,060108

I'd like to shrink it down to a 10-12 character string that a user can input.

Does anyone know of any tools to perform this?


This topic has been closed for replies.

8 replies

Inspiring
December 16, 2008

Hi,
I don't know of any ZIP-like functionality for text strings, and my recommended
solution would be the database with all the coupon codes that you have already
mentioned, and don't want to us.

But here's another thing you could try:
In the coupon code each comma separated value probably has a meaning:
cd,1111-1111-11-1,d120700000a72cbj001c,46808598,60,1,030308,060108

As example:d120700000a72cbj001c may be an expiration date. That could
be represented much shorted with a "number of days since 01/01/2000".
1111-1111-11-1 may be the partnumber for a product, which should have
a much shorter record ID in the database. "CD", if you have the partnumber
you may not need the identifier for the category since you get that from
the product record.
So "cd,1111-1111-11-1,d120700000a72cbj001c", could become 1234-1287-EF.
(ES represents a checksum, so customer can not just "build" the code they would like)

cheers,
fober


Inspiring
December 12, 2008
> cd,1111-1111-11-1,d120700000a72cbj001c,46808598,60,1,030308,060108
>
> All of the necessary information is in that string.
>
> Current process involves tucking that away in a barcode, so it is simply
> scanned into the system.

Doesn't a barcode also have a number? Why dont you give them the number
associated with the bar code?

--
Adam
Inspiring
December 11, 2008
Hi,

Why can't you use the "Encrypt" and "Decrypt" functions?..
grotycomAuthor
Participating Frequently
December 11, 2008
quote:

Originally posted by: Daverms
Hi,

Why can't you use the "Encrypt" and "Decrypt" functions?..


Encrypted strings are longer and definitely not user friendly.
Inspiring
December 11, 2008
Daverms wrote:
> Then, you might need this "Abbrevate" udf,
>
> http://cflib.org/udf/abbreviate
>
> What it does is, it output the string to your desired length with ellipsis at
> the end.. (Search Azadi's post in some old threads...)
>
> HTH
>

Actually I think grotycom is asking for tool(s) that would take a long
string and encrypt|encode it into a shorter string that can be used for
input and then decrypted|decoded back into it's original string.

I have done this with the hash() function to store long strings as
unique shorter strings, but it does not allow for the reverse decoding
back to the original string. I am not aware of any tools that do this,
but I'm sure they are out there somewhere.

grotycomAuthor
Participating Frequently
December 11, 2008
quote:

Originally posted by: Newsgroup User
Daverms wrote:
> Then, you might need this "Abbrevate" udf,
>
> http://cflib.org/udf/abbreviate
>
> What it does is, it output the string to your desired length with ellipsis at
> the end.. (Search Azadi's post in some old threads...)
>
> HTH
>

Actually I think grotycom is asking for tool(s) that would take a long
string and encrypt|encode it into a shorter string that can be used for
input and then decrypted|decoded back into it's original string.

I have done this with the hash() function to store long strings as
unique shorter strings, but it does not allow for the reverse decoding
back to the original string. I am not aware of any tools that do this,
but I'm sure they are out there somewhere.





Exactly - Hash won't work.
grotycomAuthor
Participating Frequently
December 11, 2008
That doesn't seem to do it.

Here's my predicament:

This string represent a coupon

cd,1111-1111-11-1,d120700000a72cbj001c,46808598,60,1,030308,060108

All of the necessary information is in that string.

Current process involves tucking that away in a barcode, so it is simply scanned into the system.

The new process that I'd like to put in place is to send the user a code via email that they can enter into a form.

I am trying to get away from maintaining a massive database with all of these coupon codes and attaching a unique identifier to each record that the use would enter. It's just a lot of data I don't want to store in a database. So I'd like to compress that string to a unique value and just translate it.
Inspiring
December 11, 2008
Then, you might need this "Abbrevate" udf,

http://cflib.org/udf/abbreviate

What it does is, it output the string to your desired length with ellipsis at the end.. (Search Azadi's post in some old threads...)

HTH
grotycomAuthor
Participating Frequently
December 11, 2008
I want to shrink that string into something shorter.

Then provide that shortened string to the user who would then enter it into a form and I would expand it out to it's original length and values and process the comma-delimited values.
Inspiring
December 11, 2008
Hi,

You want to limit the user to enter a string that is of 10-12 characteres?... Or else you want to shrink a long input into a shorter string?...