Advice re: minor scripting error (LN,FN,MN input string)

December 29, 2017 at 13:45:33
Specs: Windows 7
My question refers to the script included at this link: https://www.computing.net/answers/p...

I have altered the script as such:
echo Junk,CCI,Client ID,Assistance Type,Value,Qty,Qty per PU,Account, Reason, Earliest Pick-up, Latest Pick-up, Alternate Pick-up, Comments,Approval Supervisor, Date, Phone, Worker, Phone, Clerk, Phone,Date>newfile.csv

for /f "tokens=*" %%1 in (%temp%\qryApprovalNotice.txt) do (
set line=!line!%%1,
set /a ctr +=1
If !ctr! equ 8 (
set line=!line:~0,-1!
echo !line!>>newfile.csv
set ctr=
set line=
)
)

:cleanup
del %temp%\input*.txt

It is working really cool, but the results in the .csv Client ID field only reflects the first name. The input file is all in one line, but like this: lastname, firstname middleinitial.

Can anybody please explain to me what is going wrong?


See More: Advice re: minor scripting error (LN,FN,MN input string)

Report •

#1
December 30, 2017 at 01:50:06
Difficult, at best, without seeing qryApprovalNotice.txt
2017-12-30 16:44:59.07 GMT +7

=====================

M2 Get custom script or take private lessons


Report •

#2
January 10, 2018 at 07:21:16
Mechanix2Go,

Sorry about the delay, mom has dementia and been dealing with nursing home admission. Not sure how to attach file, as format may be relevant. Am pasting text of qryApprovalNotice.txt:

CAD$ Assistance Request - Approved
Thursday, December 14, 2017 3:43:03 PM
CCI#: 893393
Client ID: LastName, FirstName MI
Assistance Type: Certificate
Cub Foods
Value: $25.00
Qty 2
Qty per PU: 2
Account Client Discretion - Child Svc
Reason: Food / Groceries
Earliest Pick-up: 12/13/2017
Latest Pick-up: 1/13/2018
Alternate Pick-
Comments: Family in crisis. Made a request for rent assistance and could not as
they already got help. Family had to put all money in to rent and still
owe to avoid eviction.
Approval Supervisor LastName, FirstName MI
Information: Date: 12/14/2017 Phone 651/266-9999
Request Worker LastName, FirstName Phone 651/266-9999
Information: Clerk: LastName, FirstName MI Phone 651/266-9999
Date: 12/13/2017


The notice is sent to me as a Word doc (rtf) and I run a script to extract to a .txt file (perhaps not necessary?) and then to a .csv
The Excel results are close, but result in an extraneous column number one that I have labeled "junk." The Quantity field results in $3,000 rather than $30, but these are issues I will deal with one step at a time. I have never worked with scripts before and find them to be magical and fascinating in their power to automate. Thanks for any help you may provide :)


Report •

#3
January 11, 2018 at 05:48:24
I think we'll be money ahead if we start with the word doc.
No idea how to attach it here.
So go to my sit and email it to me.
2018-01-11 20:43:31.40 GMT +7

=====================

M2 Get custom script or take private lessons


Report •
Related Solutions


Ask Question