Jump to content

Changing data table layout


Medic873
 Share

Recommended Posts

Okay,

I have the fallowing code and the purpose is to convert some data so if a colum has a number in it the code will create a whole line for that date.

While looping through I get off some how if someone can look at this it would help greatly

all help is appreciated

#include <IE.au3>
#include <array.au3>
#Include <File.au3>
#include <string.au3>
#include <INet.au3>
 
$file = FileOpen("C:\Users\Medic873\Desktop\walmart backup.csv", 0)
$finisheddocument = FileOpen("C:\Users\Medic873\Desktop\finisheddocument.txt", 1);
Local $line = FileReadLine($file, 2)
$datadivided = StringSplit($line, ',', 1)
Local $datesstart = FileReadLine($file, 1)
$dates = StringSplit($datesstart, ',');
 
_ArrayDisplay($datadivided);
For $x = 0 To ubound($datadivided) Step +1
   $variablenumber = $x + 6;
   if $datadivided[$x] = "" Then
   Else
   FileWriteLine($finisheddocument, $datadivided[1] & ',' & $datadivided[2] & ',' &  $datadivided[3] & ',' & $datadivided[4] & ',' & $datadivided[5] & ',' & $dates[$variablenumber] & ',' & $datadivided[$variablenumber]) 
   EndIf
 
   Next
_arraydisplay($datadivided);
Link to comment
Share on other sites

Don't know why my sample data of the file didnt post but here it is

Customer Name,Full Customer Number,Store Number,Kiosk First Sale Date,Item Number,1/7/2012,1/14/2012,1/21/2012,1/28/2012,2/4/2012,2/11/2012,2/18/2012,2/25/2012,3/3/2012,3/10/2012,3/17/2012,3/24/2012,3/31/2012,4/7/2012,4/14/2012,4/21/2012,4/28/2012,5/5/2012,5/12/2012,5/19/2012,5/26/2012,6/2/2012,6/9/2012,6/16/2012,6/23/2012,6/30/2012,7/7/2012,7/14/2012,7/21/2012,7/28/2012,8/4/2012,8/11/2012,8/18/2012,8/25/2012,9/1/2012,9/8/2012,9/15/2012,9/22/2012,9/29/2012,10/6/2012,10/13/2012,10/20/2012,10/27/2012,11/3/2012,11/10/2012,11/17/2012,11/24/2012,12/1/2012,12/8/2012,12/15/2012,12/22/2012,12/29/2012
what #5893 (NOVI; MI),1012079,5893,07/18/2012,7322-1139,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,4,,,,,3,8,1
what #5893 (NOVI; MI),1012079,5893,07/18/2012,7323-12,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,,,,,,2,20,8
what #5893 (NOVI; MI),1012079,5893,07/18/2012,7324-18,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,2,,,,,6,9,2
what #5893 (NOVI; MI),1012079,5893,07/18/2012,7324-20,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,4,,,,,9,19,13
what #5893 (NOVI; MI),1012079,5893,07/18/2012,7337-02,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,13,8,,,,,6,28,11
what #5893 (NOVI; MI),1012079,5893,07/18/2012,7337-626,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,1,,,,,2,10,4
what #5893 (NOVI; MI),1012079,5893,07/18/2012,7750-04,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,13,4,,,,,6,22,10
what #5893 (NOVI; MI),1012079,5893,07/18/2012,7750-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10,3,,,,,4,11,2
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...