|
|
|||||||
Is there a way to read comma delimited files and put each segment in a variable. I know how to do it with a space delimited but with a coma delimited ??? |
||||||||
|
|
|||||||
It is done exactly the same except you Split() on the comma. Show us your code and a sample of the file. |
||||||||
|
|
|||||||
Let's say the array is $ar and come from a text files and I want to split each segment in a different variable. I did try this and it does not work. redirectoutput ('log.txt') $Ar = 1,2,3,5,7,11,17,13 $x = ASCAN($Ar, 13) ; will return '7' ? $x sleep 5 $a = SPLIT ('$Ar', ',', 1) ;$b= SPLIT ("$array", ",", 1) ;$c= SPLIT ("$array", ",", 2) ;$d= SPLIT ("$array", ",", 3) ;$e= SPLIT ("$array", ",", 4) ;$f= SPLIT ("$array", ",", 5) ;$g= SPLIT ("$array", ",", 6) ;$h= SPLIT ("$array", ",", 7) ? $a ;? $b ;? $c ;? $d ;? $e ;? $f ;? $g ;? $h sleep 15 |
||||||||
|
|
|||||||
First off, $AR is an array of values, not a comma delimited string. Code: break on |
||||||||
|
|
|||||||
Just remember that some fields can contain commas that will cause problems using SPLIT. Code:
In the above sample it may be beneficial to open the CSV using ADODB. Code:
|
||||||||
|
|
|||||||
Chris - nice - that script's a keeper ! Was looking for something like this. Now if I can only get your Active Directory browser script working in my domain. Not too sure why every time I start it, it doesn't do anything. |
||||||||
|
|
|||||||
LES, they print on the screen but how to put them in variable. |
||||||||
|
|
|||||||
Code: break on |
||||||||
|
|
|||||||
awwwhhh, Chris didn't take the bait :0( |
||||||||
|
|
|||||||
Thanks a lot LES, As you can see I am a rookie with kixtart. |
||||||||
|
|
|||||||
Ja, well... you disappointed Shawn by not snapping up Chris' most excellent ADODB code. Chris, Pure poetry in coding... brings a tear to my eye. Your daddy must be proud. |
||||||||
|
|
|||||||
For plenty of methods of transferring data with ADO INFO: Methods for Transferring Data to Excel from Visual Basic |
||||||||
|
|
|||||||
Didn't say it was poetry in coding, just that it was a precipitous bit of code for a scripty I'm doin. ;0) |
||||||||
|
|
|||||||
Not putting words in your mouth... them thar words wuz mine. Every time I think I am getting fairly proficient at coding, along comes Bryce or Chris and humble me. |
||||||||
|
|
|||||||
You could even use the DB...() UDFs to read select fields out of a CSV file by using the connection string for a CVS file. |
||||||||
|
|
|||||||
Wow - Did I hear right (humble me), from Les |