[Kexi] Importing csv

Jarosław Staniek js at iidea.pl
Mon Mar 26 22:45:52 CEST 2007


wayne said the following, On 2007-03-26 17:49:

>> Kexi performs rather clever type detection based on multiple rows, by
>> reading them first (about first 100 or so) and then it reads them again
>> when types are detected. For example, if you have 123.4 value, it will
>> be floating point UNLESS you have a non-number somewhere in the same
>> column. In the later case, Kexi uses text type.
>>
>> Once you have the CSV import window displayed you can change type of any
>> column by:
>> 1. clicking on any cell of this column;
>> 2. setting data type from the "Format for column #" combo box on the top
>> of the window
>>
>> Note: you cannot set floating point numbers and integer numbers types
>> explicitly, instead you set "Number" type and Kexi will detect whether
>> the number is oftype 'floating point' or not. This is for simplified
>> operation, but may be extended in later versions.
>>
> 
> Yes, this works fine. Thank you very much.
> 
> BTW, what's the easiest way to edit a group of records, say 100 out of 
> 2000? If I want to change the location field of each of these 100 records, 
> from location A to location B, is the following the correct procedure?

Easiest, I'd say "lame but <<intuitive>>" way would be using "Find and 
Repalce" function. "Find" is available in Kexi 1.1.3 (not released to SVN yet, 
soon to be announced on http://kexi.pl/en). "Replace" is not available at all. 
So it's jsue a note for future use cases.

> 1. Do a query on a table of 2000 records and find the 100 records that need 
> editing. 
> 2. Write down the ID numbers of each of these 100 records.
> 3. Go back into the 2000 table and find each one of the 100 by their ID 
> numbers, editing each record's location field as you go along.

Unless you want to pick records one-by-want with your mouse, you can always 
run this query using 'ksqlite':

UPDATE TABLE T SET location=B WHERE location=A AND [....your additional 
conditions that "select" your records...];

If you're sure ID is between 1 and 100, you can add "AND ID<=100" or similar 
"additional conditions" to the query. Otherwise you need a mouse-friendly 
tool, do you? :)

Sometimes in real world apps there is additional column of boolean type used 
for marking records that have to be updated, i.e. the condition could be:

... WHERE .... AND marked=TRUE;

Kexi 2.x would allow you to "draw" UPDATE queries with your mouse and possibly 
preview the results before executing.

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice: http://www.kexi.pl/en, http://www.koffice.org
  KDE3 & KDE4 Libraries for MS Windows: http://kdelibs.com, http://www.kde.org



More information about the Kexi mailing list