cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
LNitz
Level III

Column concatenation only takes some column entries

I have a sample file taken from a Covid report on reopening file dining that was originally presented as a two column journal article.  The PDF tool brought in the file as illustrated in  columns 3 and 5 of "To-dineornot_test.jmp."  The script was copied from an exchange in the Community.  I changed the names of the columns. In the file "Column D" is the result of the script.

 

I find that the concatenate operator worked ONLY on lines 3 and 9.  What am I missing?

On inspection, the cells all seem to be text. They may not be perfect renditions of the original 2 column PDF, but they are close enough.  I do not want to miss the material that did not get concatenated properly.

1 REPLY 1
txnelson
Super User

Re: Column concatenation only takes some column entries

The issue is that you have Carriage Return and New Line characters imbedded in your column 3.  If you drag the row boundary and make each cell a multiple line cell, you will see the characters that are following lines

txnelson_0-1625959694893.png

The hex values that are causing the issue are 0A and 0D.  Below is a little piece of code that will remove the values.  It will leave in the place of the 0A a blank space, but not for 0D.  The reasoning behind this, is that they always appear together, and only one blank space is needed.

Names Default To Here( 1 );
dt = Current Data Table();
For( k = 1, k <= N Rows( dt ), k++,
	value = "";
	For( i = 1, i <= Length( :column 3[k] ), i++,
		If(
			Char To Hex( Substr( :column 3[k], i, 1 ) ) ==
			"0A", value = value || " ",
			Char To Hex( Substr( :column 3[k], i, 1 ) ) !=
			"0D",
				value = value || Substr( :column 3[k], i, 1 )
		)
	);
	:column 3[k] = value;
);
Jim