Welcome! Log In Create A New Profile

Advanced

HImportText

Posted by Joris 
Joris
HImportText
March 27, 2009 10:05AM
Hi,

I have a problem with HImportText.

I have a small textfile with 5 variables separated with a ";"

This is how 1 line looks in that data file: 1;001;VAK;0;1;;

In my program I want to import this data with HImportText as follows

IF HImportText("F_CATEGORY","C:\GOL\CAT.txt";"Nr;F_NR;TYPE;SER;CLIENT;;",hdefaultVal) = False THEN
Error "Unable to import")
END

As I want to work with ";" in stead of "," separataors is that a problem?
What do I need to change to make this work?

Thanks .

best regards,
Joris.
Fabrice Harari.pcs.crosspost
Re: HImportText
March 27, 2009 01:52PM
Hi Joris...

You should read in detail the syntax of hImportText in the help... In
partivcular, it says:
You used:
"Nr;F_NR;TYPE;SER;CLIENT;;"
but it says:
List of item names in the text file. The names can be delimited by
single quotes and they are separated by commas or CR characters.
and the example is:
"NAME,ADDRESS,LOGO"
So here you should already REPLACe your ; by , (we are not talking here
about the separators in the file but about the SYNTAX accepted by
himporttext)

THEN you should use the SEPARATOR parameter to says that it's a ";", and
the help says:
List of separators used for the columns, the strings, the rows and the
decimal places.
The different separators are separated by Charact(127) (for
compatibility with WinDev 5.5).
<Column Separator> + Charact(127) + <String Separator> + Charact(127) +
<Row Separator> + Charact(127) + <Decimal Separator>

<Column Separator>: Character string ("," by default).
<String Separator>: Character (" by default)
<Line Separator>: Character string (CR by default, i.e.
Charact(13)+Charact(10))
<Decimal Separator>: Character ("." or "," by default)

so you should have something like
";"+Charact(127)+""+Charact(127)+cr+Charact(127)+"."

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on [www.fabriceharari.com]


Joris wrote:
> Hi,
> I have a problem with HImportText.
> I have a small textfile with 5 variables separated with a ";"
> This is how 1 line looks in that data file: 1;001;VAK;0;1;;
> In my program I want to import this data with HImportText as follows
> IF HImportText("F_CATEGORY","C:\GOL\CAT.txt";"Nr;F_NR;TYPE;SER;CLIENT;;",hdefaultVal) = False THEN
> Error "Unable to import")
> END
> As I want to work with ";" in stead of "," separataors is that a problem?
> What do I need to change to make this work?
> Thanks .
> best regards,
> Joris.
>
Message forwarded from pcsoft.us.windev
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: