Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pasting parallel columns in word (without columns) 1

Status
Not open for further replies.

jlockley

Technical User
Nov 28, 2001
1,522
US
I am trying to develop a script for Paradox for which two parallel columns of text need to be next to each other. Since there are a couple of hundred items to place and I have the text in perfectly matched columns, I am hoping against hope that there's a way to do it in Word or any other program. Notepad++ has helped on some instances, but not here.

Column 1 would be
StNAME
stLOCATION
stTITLE
stPARTNER


and column two

= fldNAME'value
= fldLOCATION'value
= fldTITLE'value
= fldPARTNER'value

yada

desired outcome
StNAME = fldNAME'value
stLOCATION = fldLOCATION'value
stTITLE = fldTITLE'value
stPARTNER = fldPARTNER'value

spaces of no consequence, btw, but they must be in columns

I had thought that I could sneak it through by converting a table to text but it places the columns after rather than next to each other.

This needs to go into an ascii or text file, btw, so actual columns (which merely appear parallel) or visual columns are not an option.

Push come to shove, I can shorten the process using Clipmate sequential paste option, but I am wondering if there's a trick I haven't figured out yet.



 
Note: Tried to sneak it by Excel. I do not have Acrobat.
 
Hi jlockley,

In Word, you could work with just the column 2 data, using a wildcard Find/replace, where:
Find = (=[ ]{1,}fld)(*)('value)
Replace = st\2 \1\2\3


Cheers
[MS MVP - Word]
 
That's brand new..I have about 200 fields to process, so it would be replace = st\2 /1/2/3/4/,,,212?

This can be done by the interface?

Thanks.

How does the value in the first column refer to the (equal) value in the 2nd?
 
Hi jlockley,

Use the wildcard Find/Replace exactly as described - via the Find/Replace interface. It'll process all your fields in one pass.

As for how it works, the Find expression breaks the RHS expression into three parts, as indicated by the (). The replace expression starts of with the 'st', adds the second part from the Find expression, then a space, followed by the original three parts of the Find expression. On reflection, you could simplify the Replace to:
Replace = st\2 ^&


Cheers
[MS MVP - Word]
 
It didn't work (no replacements). It's something I have to look into, though. I'll use notepad++ to add the = sign to the first column and see if I can get Clipmate to automate something.


Thanks. I think this is something I need to know more about.
 
Thanks. I've just been reading up on it and need to get deeper. I've only used a few wild cards. I did get this finished with clipmate, but there's more.


may I ask another question, is there a parameter which permits taking a word like say "iguana" and expanding a phrase to include it multiple times?

For instance
iguana
igloo
Iggy_Pop
find <ig

BTW, I've found this:


paste: I just read about $<ig in a book put out by the national $<ig society......... I don't think I would like to live near an $<ig

The practical application would be:

for each of the fields, I need to create the following entry:

if stOrderID.isBlank() then
stOrderID = "Check"
else
stOrderID = "Check " + stOrderID
endif

It's pretty straight forward until I need to repeat each field pointer (stOrderID)

I've got the first line down using ^p
With my knowledge I now have two options, neither ideal:
1) Convert the list into a table and use merge. Probably the easiest.

2) create three distinct pieces of code and then do the same work I did with climate before to power paste them in. This gets a little nastier, since I can't "explode" the clips on the board into separate paste objects.
 
Hi jlockley,

I'll use notepad++ to add the = sign to the first column
Your first post indicated the '=' sign was already there. The Find/Replace I gave you was based on that advice. If the '=' sign isn't already there, change the Find/Replace to:
Find = (fld)(*)('value)
Replace = st\2 = \1\2\3
is there a parameter which permits taking a word like say "iguana" and expanding a phrase to include it multiple times?
This would ordinarily be dealt with as an Autotext entry, but even a simple Find/Replace can change all instances of $<ig or <ig to iguana.

I don't really understant your 'practical application'. If, for example, you have a number of instances of a string and you want to replace them with the whole 'If ... End If' statement, simply type in the Find & Replace text, using ^p an ^t in the latter to represent paragraph breaks and tabs, respectively.


Cheers
[MS MVP - Word]
 
ah.. I had a column with and a column without, and I must have tried it on the wrong one. Obviously. Thanks again.
 
To answer your question, here's the application.
I began with a list of 200+ field names taken from the database and needed to insert them into the various declarations and calls. There is (was) no text, except the template command. I needed to build it, so I had a list of fields to insert. I actually did it using merge, which took about half an hour. Very good for all this. This is an intersting issue, however, and I will pursue it after I have my script up and running.

Thank you very much for all your help.


method pushButton(var eventInfo Event)
var
StNAME String
stLOCATION String
stTITLE String
stPARTNER String
stDATE String
stTelephone String
stFax String

;...sample of about 200 fields

Endvar
;============================== Parameters

if StNAME.isBlank() then
StNAME = "Check"
else
StNAME = "Check, " + StNAME
endif
;.................
if stLOCATION.isBlank() then
stLOCATION = "Check"
else
stLOCATION = "Check, " + stLOCATION
endif
;.................
if stTITLE.isBlank() then
stTITLE = "Check"
else
stTITLE = "Check, " + stTITLE
endif
;.................
if stPARTNER.isBlank() then
stPARTNER = "Check"
else
stPARTNER = "Check, " + stPARTNER
endif
;.................
if stDATE.isBlank() then
stDATE = "Check"
else
stDATE = "Check, " + stDATE
endif
;.................
if stTelephone.isBlank() then
stTelephone = "Check"
else
stTelephone = "Check, " + stTelephone
endif
;.................
if stFax.isBlank() then
stFax = "Check"
else
stFax = "Check, " + stFax
endif

;.......etc end parameters

:........Query


quQuery = QUERY


ANSWER: : C:\Roladex\results.DB


newrol.DB | NAME | LOCATION | TITLE | PARTNER | DATE | Telephone |
| Check | Check | Check | Check | Check | Check |

newrol.DB | Fax |
| Check |
;......sample of about two hundred fields

ENDQUERY

quQuery = QUERY



errorTrapOnWarnings(Yes)
quQuery.writeQBE(":Work:Query.QBE")
try
quQuery.executeQBE()
tvResults.open(":Work:OrderInfo1.DB")
tvResults.wait()
tvResults.close()
onFail
errorShow()
msgStop("", "")
endTry
errorTrapOnWarnings(No)

endMethod

| Check |
 
Hi jlockley,

If you were starting out with, say:

StNAME
stLOCATION
stTITLE
stPARTNER

and you wanted to turn each of these into statements like:

if stNAME.isBlank() then
stNAME = "Check"
else
stNAME = "Check, " + stNAME
endif
;.................

that could all be done with a single wildcard Find/Replace, where:
Find = ([Ss]t)([!^13]{1,})
Replace = if ^& .isBlank() then^p^t^& = "Check"^pelse^p^t^& = "Check" + \2^pendif^p;.................
If you wanted, you could add some extra spaces/tabs to achieve the indenting indicated in your post.

The reason for having ([Ss]t) in the Find expression, rather than just (st) is that your post suggests some strings begin the 'S' whilst others begin with 's'.


Cheers
[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top