Jump to content

Recommended Posts

Posted

Good morning :)

 

I need you  help / advise. I got a flat CSV invoice file like:

INVNo|ProductName|Description|PRICE

17146330|PRODUCT A|Description|29.30
17146330|PRODUCT B|Description|50.30
17147635|PRODUCT B|Description|50.30
17147635|PRODUCT C|Description|100.00
17147698|PRODUCT D|Description|50.00
17147887|PRODUCT C|Description|100.00
17147887|PRODUCT D|Description|50.00
17149649|PRODUCT A|Description|29.30
17149649|PRODUCT A|Description|29.30
 

For each Invoice No i need a new CSV file - Do you have any idea how this might work?

 

Thanks for helping !

 

Marcus

 

Posted

Hi,

i got the invoice (flat) file on a daily base and the structure of the file is fix. 

My question is, how is the best way to regonize a new invoice no .

 

Marcus

Posted

You just need something like:

#include <Array.au3>
#include <File.au3>

Global $sTargetDir = @ScriptDir & "\Invoices"
    If FileExists($sTargetDir) = 0 Then DirCreate($sTargetDir)
Global $sSource = @ScriptDir & "\Flat.csv"
Global $aSource
_FileReadToArray($sSource, $aSource, 1, "|")
    If @error Then Exit
For $i = 1 To $aSource[0][0]
    FileWrite($sTargetDir & "\" & $aSource[$i][0] & ".csv", _ArrayToString($aSource, ",", $i, $i) & @CRLF)
Next

 

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
  • Recently Browsing   0 members

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