Hi All,
I am trying to read up a csv file. Works fine running on winapp running localhost. However when I move it to my VPS, obviously it can not find the file on my VPS as it is local.
As I see it, I can upload the file to the server first or can i Change my code in someway to see the file on my computer from the server.
I have attached the code. Thanks in advance.
Phil the ABMRockster, ABMaterial rocks and Alian is a seriously good coder.....
I am trying to read up a csv file. Works fine running on winapp running localhost. However when I move it to my VPS, obviously it can not find the file on my VPS as it is local.
As I see it, I can upload the file to the server first or can i Change my code in someway to see the file on my computer from the server.
I have attached the code. Thanks in advance.
Phil the ABMRockster, ABMaterial rocks and Alian is a seriously good coder.....
B4X:
Sub section0ainp1_Changed(value As String)
Dim myTabs As ABMTabs = page.Component("mypageTab1")
Dim myContainer1 As ABMContainer = myTabs.GetTabPage("TAB1")
Dim myContainer2 As ABMContainer = myContainer1.Component("tab1Right")
Dim myContainer3 As ABMContainer = myContainer2.Component("section0a")
Dim inp1 As ABMFileInput = myContainer3.Component("section0ainp1")
Dim myFile As String = inp1.GetFileName
Dim su As StringUtils
' header
Dim myTransaction As String = DateTime.Now
Dim mySalesdate As String
Dim mySalesTime As String = DateTime.Time(DateTime.Now)
Dim mySalesamount As Double = 0
Dim myPayoutamount As Double = 0
Dim myFeeamount As Double = 0
Dim myLayaway As Double = 0
Dim myTaxAmount As Double = 0
Dim mySalesStatus As String = "UNCHECKED"
Dim myUser As String = ABMShared.myUsername
Dim sql1 As SQL
sql1.Initialize2("com.mysql.jdbc.Driver", "jdbc:mysql://" & ABMShared.myServerAddress & "/" & ABMShared.myServerDatabase, ABMShared.myServerUsername, ABMShared.myServerPassword)
Dim lst1 As List
lst1 = su.LoadCSV("c:\CSV", myFile , ",") '<<<<------------------------------- here is the issue
For i = 2 To lst1.Size - 1
Dim sColumn() As String
sColumn = lst1.Get(i)
'calculate headers ---------------------------------------
If sColumn(3) = "Fee" Then
mySalesamount = mySalesamount + sColumn(11).SubString(1)
myFeeamount = myFeeamount + sColumn(11).SubString(1)
Else
mySalesamount = mySalesamount + sColumn(11).SubString(1)
End If
myTaxAmount = myTaxAmount + sColumn(12).SubString(1)
'get items information -----------------------------------
mySalesdate = ABMShared.setdate
mySalesTime = sColumn(1)
Dim myTime As String = sColumn(1)
Dim myCatagory As String = sColumn(3)
Dim myTypecode As String = sColumn(4)
Dim myTypename As String = sColumn(4)
Dim myqty As Int = sColumn(5)
Dim myGross As Double = sColumn(9).SubString(1)
Dim myNet As Double = sColumn(11).SubString(1)
Dim myDiscount As Double = sColumn(10).SubString(1)
Dim myTax As Double = sColumn(12).SubString(1)
Dim myContractNumber As String = sColumn(16)
Dim myContractName As String = "ERROR"
Dim myStorecode As String = sColumn(19)
Dim myStorename As String = "ERROR"
Dim myItemstatus As String = "ERROR"
sql1.ExecNonQuery2("INSERT INTO salesitems VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object(myTransaction,mySalesdate,myTime,myCatagory,myTypecode,myTypename,myqty,myGross,myNet,myDiscount,myTax,myContractNumber,myContractName,myStorecode,myStorename,myItemstatus))
Next
End Sub