1. John Vanleeuwe
  2. PowerBuilder
  3. Wednesday, 24 July 2019 07:31 AM UTC

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. Wednesday, 24 July 2019 12:54 PM UTC
  2. PowerBuilder
  3. # 1

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.
Kevin Ridley Accepted Answer Pending Moderation
  1. Wednesday, 24 July 2019 11:27 AM UTC
  2. PowerBuilder
  3. # 2

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.
Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 24 July 2019 10:28 AM UTC
  2. PowerBuilder
  3. # 3

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
  1. John Vanleeuwe
  2. Wednesday, 24 July 2019 10:47 AM UTC
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. Helpful
  1. Roland Smith
  2. Wednesday, 24 July 2019 12:58 PM UTC
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. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.