Jump to content

Array Question


Recommended Posts

Hello,

       I am having an issue with pulling a file into an Array.  I have a pipe | delimited text file.   Now I can pull that file into excel with no issues.  All the columns and rows are good.  Now with no issue pulling that file into excel shouldn't I be able to file read to array using the pipe | delimiter?   But I cannot get this file into an array using the pipe delimiter. 

_FileReadToArray("C:\OPATemp\temp.txt", $avArray, $FRTA_NOCOUNT, "|")  ;No array created.  @error 1  $avArray is not an array
_FileReadToArray("C:\OPATemp\temp.txt", $avArray, $FRTA_NOCOUNT)       ;Creates an array but all in one column
_FileReadToArray("C:\OPATemp\temp.txt", $avArray, $FRTA_NOCOUNT + $FRTA_INTARRAYS, "|")  ; Creates an array of arrays

It is with this last one that I noticed the issue.  The array of arrays are different lengths.   But that is what is confusing me.   How can that be if I am able to pull into excel with no issues?   Thank you for any help

Link to comment
Share on other sites

There must be an error in your file, you must have too many delimiters on some lines, compare to others.  They need to be perfectly identical in each line.  That is probably why it is working for array of arrays...

Upload the file if you can't find the discrepancies

 

Link to comment
Share on other sites

can you upload one of these files, or a reasonable snippet thereof?

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

19 minutes ago, xcaliber13 said:

but wouldn't that be the same to pull the file into Excel?

No it is not a requirement in Excel.  It will pull whatever there is in the file.  In autoit, that is why you have array of arrays, in case each lines don't respect the same number of delimiters...Look at a trailing useless delimiter ^_^

Edited by Nine
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...