Delimited Variable

Phillip

Member
Is there a way to break a delimited variable into columns of a temp table similar to the procedure for importing a delimited file? For example I want to break the following string:

PONum:123456, Item:test1, Quantity:3

Into a temp table to look like this:

PONum:123456 | Item:test1 | Quantity:3
 

Cringer

ProgressTalk.com Moderator
Staff member
Not sure I understand what you want. Do you want to create a temp table with the columns PONum, Item and Quantity, with the values given? If so, look at dynamic temp-tables. They're a bit of a stretch for the brain to start with, but you'll get there. Oh, and you need to make sure you clean your handles up when you're done.
 

TheMadDBA

Active Member
If you are just interested in parsing the values into a known number of columns look at NUM-ENTRIES and ENTRY
 
I think you should check REPLACE function. Initially, you have to fetch the string along with delimiter used, manipulate that according to your requirement (use REPLACE function) and than use it in temp-table or wherever you want.

Thanks & Regards!
Rajat.
 

TomBascom

Curmudgeon
It would be very nice if IMPORT & EXPORT worked on strings and longchars but they do not.

ENTRY( index, string, delimiter ) will break a string into its components. Converting them to appropriate data types is just a little code. You could do some dynamic magic to look at the target buffer and figure it out. Or if this is a known target you could just hard code it.
 

tamhas

ProgressTalk.com Sponsor
Note too that

entry(1,entry(N,String),":") will give you the field name of the Nth field and entry(2,entry(N,String),":") will give you the string value of that field.
 
Top