Direct csv import into Base table

Zolnai Tamás zolnaitamas2000 at gmail.com
Mon Jun 3 12:49:01 PDT 2013


Hi Lionel,

Whether the access the source is read-only or read-write depends on
> the underlying driver; for CSV it is probably read-only, be it only
> for lack of a primary key. For DBaseIII, for example, I think it is
> read/write.
>
> But Read-only access to the source is all you need for import, so I
> don't quite get the point in the current discussion.


You misunderstood me. I just speak about what the connection feature offer
directly. It offers read-only access to calc comaptible files (including
text files). It is other question that these read-only tables can be
copied.


> > The feature which I intend to implement is making a new table and
> > insert into the already opened database.
>
> Yes, which is exactly what the procedure described in my previous mail
> also does. Except it is not limited to CSV and other calc-supported
> formats (but any supported database), and already gives you access to
> each sheet of a calc file instead of the first.
>
> Which was my main motivation for slapping a better UI on *this*
> procedure rather than on the more limited "go through Calc" route.
>

Well, misunderstandness around. I means making a new table and insert it
into the already opened database *in one step*, or more steps but in an
automated serial and without opening other window and without copy&paste. I
see that the procedure that you described is working and results the same.


> > With this I just say that for the user it can be looked as a
> > different thing and so not make confusion.
>
> Well, if "drag'n drop" and "import" of the *same* data behave
> differently in the *same* application (that is, Base), I think this is
> confusing and unpredictable: even if the user knows of these two ways,
> why would he expect one to work "better" or "different" than the
> other?


I don't know what difference we actually speak about. In my first plan I
intended to use the same paste method and the same "Copy Table" dialog
which is used for "drag'n drop". The difference is in loading of the source
file and so the used csv import UI. But it can confusing too, so it might
be clearer to use the same as in "Connect to an existing database" option.


> > Implementation is an other part. Of course I will look up the code
> > of this connection thing and reuse all the usefull code. But the
> > implementation which I planed is not means real new code, but
> > intentse use of UNO API.
>
> Once you have a SDBC URL, the rest of the work is also completely
> through the UNO API: I expect in
>  com.sun.star.sdb
>  com.sun.star.sdbc
>  com.sun.star.sdbcx
>
> I expect that the existing code path used when copy/pasting from one
> Base file to the other uses pretty much these APIs.


I will look up these things.


>
>
> The Writer OLE-object feature (...) the same file import as Calc do
> > (...) which more usefull than the page with the same aim in
> > Base. More usefull means more options and a table showing the
> > expected result.
>
> Well, if the CSV setup screen in Base sucks, we can fix
> *that*. Possibly even use the same setup screen than in Calc? As in:
> merge the two.


As I see its not an easy hack. In Clalc the import UI is a ModalDialog,
while in Base it is a TabPage which are not a 'mergeable' pair, at least I
don't see the way. Additionally in Base wizard there is no enough space for
all options and for the table which are in the Calc csv import dialog. Plus
the content of the mentioned table (containing expected result) is already
loaded in case of Calc, but in Base file-loading is happen after setting
the csv import options.

 If you do that (additionally to the easier Base import UI), you'll

have enhanced not only "import into new base file" but also "connect
> to CSV directly", which is used e.g. by Writer's mail merge, as well
> as by Base. I.e. it has broader appeal / applicability for our users.
>
>
> IMO, having a "import into any database from any database" feature is
> also more broadly useful than only "import into any database from a
> Calc-supported file". So I'd prefer we had the former; I don't think
> it is essentially more difficult, but I agree that for the specific
> case of CSV, enhancing Base's connect UI to match Calc's open UI *is*
> definitely an additional work.
>

I just imagine a 4th option to the start page of Base wizard, with label
"Import table(s) from existing database". For a simple user I think it is
not so obvious that this option can be used to import a table from a
spreadsheet (for example), because by default a spreadsheet not a database
(the same problem i have with "Connect to an existing database" option). Of
course it is good that this option can be used in general, for all
databases but if the user can't see for the first sight that which option
can be used to solve his\her problem than this option not works.


> CSV seems to be more important for you than "all other database
> formats", I don't know why <shrug>. From a broader perspective, I
> would regret that Base has a more restricted-to-CSV "import"
> functionality (rather than "import from any database, including CSV")
> only to marginally better serve the CSV case in the short term.


The reason is that I have this task: to add a simple way to import tables
from calc compatible files. :D
But let see how can I use the existent Base wizard and "Connect to an
existing database" option, maybe it can be extended easily.



> >>>    The only question is where this feature would be reachable. I have
> two
> >>> ideas and I think all of these two places should be used:
> >>>    1. Table view -> "Tasks". Add a 4th option like "Import Table From
> >>> File...". This point contains all other places which are almost the
> >>> duplicates of this "Tables" list (e.g. Insert menu with label "Table
> >>> (Import)..." ).
> >>>    2. Table view -> "Tables" -> context menu. The label can be "Import
> >>> Table...".
>
> >> The context menu does not make that much sense to me, unless we *also*
> >> add the other tasks to it (and then also in Queries, Forms and Reports).
>
> > It comes in my mind just because the commonly used method is the
> > copy&paste
>
> You mean "copy&paste from Calc". Is it? It would not have occurred to
> me to do a Calc-to-Base copy&paste rather than a Base-to-Base
> copy&paste.
>
>
> Anyway, there is another idea for "how to make this feature
> reachable":
>
> 1) Open a file manager
>
> 2) Open the LibreOffice window where you want to import the data.
>
> 2) Drag-n-drop the file into the LibreOffice window.
>
> This currently works for a Calc window, but not for a Base window. I
> think it would be amazing if additionally to the tasks pane, drag'n
> drop worked.


You have amazing ideas :) But not enough time to implement all of them.

Best Regards,
Tamás
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20130603/86e576c7/attachment.html>


More information about the LibreOffice mailing list