1. John Vanleeuwe
  2. PowerBuilder
  3. Wednesday, 24 July 2019

Hi guys,

 

we have a CSV input file where the different columns are delimited by the ; sign ( not the comma, not a TAB ) it is ; sign.

 

dw_1.ImportFile fails when the ; sign is the delimiter , i read in the help that only commas , tabs are recognised by the importfile function.

 

What are my options to get the contents of the CSV file in my datawindow WITHOUT having to loop trough the file and doing some replaces ?

 

TIA

John

Olan Knight Accepted Answer Pending Moderation
1
Votes
Undo

If yo do not want to import it into an Excel file, an in Excel you can specify the delimiter, then you are stuck.

a. Imort the file as a series of strings with one string read per line in the import file
b. Parse through the string to get your tokens.
    Note: If you are using the PFC that capability already exists. If not, take the ParseArray function from he PFC and use it.


Olan

Comment
There are no comments made yet.
  1. Wednesday, 24 July 2019
  2. PowerBuilder
  3. # 1
Kevin Ridley Accepted Answer Pending Moderation
0
Votes
Undo

You could always import it into Excel, then export it to actual csv or tab delimited.  Another option is SSIS, you could setup a job there to import and write to a table etc.

Comment
There are no comments made yet.
  1. Wednesday, 24 July 2019
  2. PowerBuilder
  3. # 2
Roland Smith Accepted Answer Pending Moderation
0
Votes
Undo

The C in CSV stands for Comma so what you have isn't CSV.

Do you have control over the program that created the file?

 

Comment
Thanks Roland.



we are not in control of the CSV nor the contents. Its all decided by government institution. We are only receiving it , need to import it , process it and that's it.



TIA

John



  1. John Vanleeuwe
  2. Wednesday, 24 July 2019
I have code to do ReplaceAll and Split if needed. It also gives very fast string concatenation.

http://www.topwizprogramming.com/freecode_stringclass.html

  1. Roland Smith
  2. Wednesday, 24 July 2019
There are no comments made yet.
  1. Wednesday, 24 July 2019
  2. PowerBuilder
  3. # 3
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.