Jump to content
Macro Express Forums

Array Too Small / Processing CSV Data


Recommended Posts

Hi All,

Been a minute (ok, years?!) since I posted anything here. Usually, I can spot my errors the 2nd or 3rd time around... but this is eating my lunch. And, to be honest, it's been a couple years since I really tore into MEP (updated to current version). Running Windows 11. 

  
A little background:
So I have a list of street, city, state, zip codes, that I'm preparing a mailing list for. I'm also going to a website to look up the resident name that lives at the specific address for the specific record I want.  

The sample INPUT .CSV looks like: (Sorry about the crappy formatting/justication here - but it's a legit .CSV).  (Data sanitized for the protection of the innocent!)

Name: Number: Street Text: Text Joined: City: State: Zip: Comments:
  27541 E 121st St S 27541 E 121st St S XXXXX XX XXXXX  
  27554 E 121st St S 27554 E 121st St S XXXXX XX XXXXX  
  27730 E 121st St S 27730 E 121st St S XXXXX XX XXXXX  
  27756 E 121st St S 27756 E 121st St S XXXXX XX XXXXX  
  27856 E 121st St S 27856 E 121st St S XXXXX XX XXXXX  

 


Note: The first field (Name) is empty (that'll hopefully get filled in as a result of the query). There are a few websites you can do free name/address lookups on; e.g.: Melissa.com,  Fast People Search, etc.  But when I run the code, I get an "Array too small" in these lines of code.  It fails (errors) on the ASCII FILE BEGIN PROCESS line. I've tried some different options (clearing, not clearing array, etc.).  Is the NAME field being empty/null a problem?  I thought I could "index" it to start with the "Text Joined" field (Field #4 = Index #4?), and begin processing on record #2 (to avoid processing the header row, right?).  Street Text looks like a complete street address. It isn't. It's only the "E 121st St S"  portion, and "Number" is just that - that actual address number. Long story but this makes for much more rapid data entry. Yes, there are reasons why the street data is initially broken up like this and then concatenated into a legit street address. 
 

<LABEL Name="Begin Lookup"/>
<LABEL Name="Begin File Read" _COMMENT="Start the file read. Reads one record at a time."/>
<DELAY Flags="\x01" Time="1"/>
<ASCII FILE BEGIN PROCESS Filename="C:\\Users\\pffer\\OneDrive\\Desktop\\INPUT FS Test Data For MEX.csv" Format="CSV" Start_Record="3" Process_All="TRUE" Records="1" Variable="%ReadFromFPS_CSVFile%" Start_Index="4" Parse_Blank_Lines="FALSE" Clear_Array="FALSE" _COMMENT="Read the file..."/>

While I'm at it... does anyone foresee any issue writing the name I extract back into this same file?  Or should I just write to a new text / CSV file. 

End game: Legit USPS address labels my Dymo printer -  for a non-profit organization  (I'm doing this on my own dime for them, so there's that, LOL!). 

Hopefully, this makes sense. Let me know if you have any thoughts on the "Array Too Small" message or any other tips. 

Thanks for any hints, tips, etc. 
 

--Pete

P.S.: I should add: The webpage in question (https://lookups.melissa.com/home/personator/)  doesn't use / like "Controls".  

 

Link to comment
Share on other sites

%ReadFromFPS_CSVFile%

I can't see your variable definition. What is the array size set to? And do you have it defined to be an array? IN the Variables property box you should have the box "Create as an array" checed and the number of elements you want below that. 

  • Thanks 1
Link to comment
Share on other sites

There is no command to write into a delimited text file. You have to do that yourself. I prefer and recommend you use tab as the delimiter as in most cases it will eliminate the need for quotes for text identifiers. I build it with arrays using tabs, carriage return, and line feeds special characters and stuff it in a variable and save that to file. It's handy to make another macro for this to keep as a function for other things. Here's a page I wrote on the special characters. Here's one I wrote about processing tabular data.  That should give you a JATO start. 

  • Thanks 1
Link to comment
Share on other sites

Thanks, Cory, I appreciate the rapid response.  I will check out your suggestions and the links (eager to read!). Things are slowly coming back to me. 

Pro tip:  Never get old and/or medicated!

JATO start appreciated... Cleared for takeoff... 

--Pete

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...