Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Making CSV import file Post Reply Post New Topic
Author Message
Wouter1980
Newbie
Newbie


Joined: 27 Mar 2013
Location: Netherlands
Online Status: Offline
Posts: 6
Quote Wouter1980 Replybullet Topic: Making CSV import file
     Posted: 05 Apr 2013 at 4:31am
Hello,
 
I made a reports with some data for DB 1 which i want to import in DB 2.
For importing the data in DB 2 we use a .csv file with a fixed protocol
 
for example:
 
"I";84860;"KALKOENROLLADE GEG 45 GR HAL B";       2;       2;         2
"I";82886;"KIPPENJUS    B                                 ";     67;      70;       74
"I";83222;"SPRUITJES    B                                  ";   190;    200;     210
"I";83021;"AARDAPPELEN GEK  B                       ";   238;    250;     263
 
When i export the data from DB 1with CR as an CSV file the positions jump everytime and it doesn't corresponds to the protocol
 
for example
 
"I";84860;"KALKOENROLLADE GEG 45 GR HAL B";2;2;2
"I";82886;"KIPPENJUS    B";67;70; 74
"I";83222;"SPRUITJES    B";190;200;210
"I";83021;"AARDAPPELEN GEK  B";238;250;263
 
Does someone know how to define the lengt of a field? So the length of a field will be always the same (string and number) and when the results is shorter it wil be filled with space
 
thnx
 
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 05 Apr 2013 at 6:51am
The only way I know how to do it is converting everything to strings and padding with extra spaces.

Example, assumes a fixed length of 20 for the output:
if isnull({somefield}) then space(20)
else
{somefield}& space(20-length(somefield))
IP IP Logged
Gurbs
Senior Member
Senior Member
Avatar

Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Quote Gurbs Replybullet Posted: 07 Apr 2013 at 10:38pm
What you could do after that, is trimming the different fields, so you don't have all the spare spaces. just something like trim({field})
IP IP Logged
Wouter1980
Newbie
Newbie


Joined: 27 Mar 2013
Location: Netherlands
Online Status: Offline
Posts: 6
Quote Wouter1980 Replybullet Posted: 09 Apr 2013 at 11:24pm
It worked out. Thanks for your help
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum