[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Importing Customers, Vendors, Parts




Roderick A. Anderson wrote:
Paul Bente wrote:
I have seen mention on this list of success in importing into LSMB
lists of customers, vendors, and parts from csv files, but not in a
form simple and detailed enough to for me to follow and succeed.

I was able to get the sample file "lsmb02-cli-example.pl" in
ledgersmb/doc/samples to work apparently (it reported the 3 sample
records as SAVED, etc and when I log in the records are there) but it
then follows with about 40 lines reporting errors of the type:

Use of uninitialized value in substr at importvendor.pl line 61,
<DATA> line 4.
Use of uninitialized value in scalar assignment at importvendor.pl
line 130, <DATA> line 4.
Use of uninitialized value in concatenation (.) or string at
importvendor.pl line 61, <DATA> line 4.
...
Use of uninitialized value in concatenation (.) or string at
importvendor.pl line 86, <DATA> line 4.

<snip />

...

There were blank lines after the data.

Any idea as to the source or significance of these errors or how I
might modify the script to eliminate them?

Make sure there are no blank lines -- only data -- in the section after
the __END__.

I'll look at a simple check for a blank line and quit if found. This
will not protect against bad data.  That will take a few more fixes to
handle that and will probably in a simplistic way. Put a blank or 'UKN'
for strings and zero '0' for numbers.  What do folks think or want?


Thanks for troubleshooting this. I was away for a couple days. Removing the blank lines eliminates the errors.

IMHO an additional line or two of comment in the script would be sufficient to warn about making sure there are no blank lines in the data. Other comments about which columns are required, which can be left blank and other data constraints would be a useful alternative to data integrity checks in the script. Inserting 0 or UKN when required would be OK. Importing data is generally done when first using lsmb and I would expect to review the imported records carefully.

I'm using pgAdmin to look at the database structure and I noticed that the (max) string length in the script doesn't always correspond to the data type.
For example line 66:
'&address1='     . escape(substr($rec[4],0,35)) .
while the data type for address1 is character varying(32).
I'm guessing the 0,35 tells the script to look for a string of up to 36 characters.

Regards,
Paul Bente