B4J Question Multi-column List problem

Mikelgiles

Active Member
Licensed User
Longtime User
I have tried multiple ways to read the 8 elements in the csv file in the example with no success. It seems that it should be simple but I have not figured it out. I need to be able to read what is in the columns in the ImportTransactions sub. In VB6 I know how to do it but doing it via a list seems so slick that I want to use it if possible. I expect that there has to be an array involved but I tried several ways with no success. Any help appreciated.

I stripped out about 90% of the code from the program so only this one problem is demonstrated.

I have included code below and the project zipped (via Windows rather than the tool in B4J). For some reason the process in B4J did not include the sub folders. Any thoughts?


B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private dirHome,dirDownloads As String
End Sub
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    'MainForm.RootPane.LoadLayout("Detail")
    dirHome = GetSystemProperty("user.home","")
    dirDownloads = dirHome & "\Downloads"
    ImportTransactions
End Sub
Sub ImportTransactions
    Dim  suTran    As StringUtils
    Dim lsTran As List =   suTran.LoadCSV(File.DirApp , "transactions.csv", ",")
    For L = 1 To lsTran.Size - 1
                                                         'Need to read the 8 elements of the csv record here.
         Log(L & lsTran.Get(L) )                 ' this just gets some hex stuff 
    Next
End Sub
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Just after this line:
For L = 1To lsTran.Size - 1

Write
B4X:
Dim arr() as string = lstrans.get(L)

'Now you have access to the whole line.
Log(arr(0)) 'first column of L row
 
Upvote 0

Mikelgiles

Active Member
Licensed User
Longtime User
Just after this line:
For L = 1To lsTran.Size - 1

Write
B4X:
Dim arr() as string = lstrans.get(L)

'Now you have access to the whole line.
Log(arr(0)) 'first column of L row

Works like a charm. i knew it had to be something simple. I thought I had already tried several things very similar and I kept getting hex stuff. I guess it must have just 'looked' similar. Thank you good sir!
 
Upvote 0
Top