date type predefined value in kexi table

Asked by LordMax

HI to all

Sorry for my bad english, I'm italian nd not used to write in other languages.

I need to insert many row in a table with many date value, they're all at now in the start so I'll need to have it automatically inserted but I haven't find how.

And in other hand, if I want to cancel a predefind value... in the table definition. Apparently there isn't a way to do it.

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu koffice Edit question
Assignee:
No assignee Edit question
Solved by:
LordMax
Solved:
Last query:
Last reply:
Revision history for this message
Anne Wainwright (anotheranne) said :
#1

Do you mean getting bulk data into a database created by kexi? In that case you would need to connect to the database outside of kexi and 'COPY' your data in from a delimited file.
Kexi will only handle basic CRUD tasks.

What database are you using, the inbuilt sqlite, or a networked mysql or postgresql database?
Whichever, you probably need to access the appropriate handbook for the database used (online). Be warned, the data must be 100% correct and match the field types precisely.

anotheranne

Revision history for this message
LordMax (lordmax) said :
#2

NO.
Sorry.
I mean insert data by hand.
I had many row to insert manually.
Every row had some date to input into.
Every date had the same value (at the insert time).
But I haven't find how to say at the table to use the current date time value in insert mode.

Revision history for this message
Anne Wainwright (anotheranne) said :
#3

OK, what you would do is open the table in design, select the date row, in the Properties at the right set the required date (ie. today's date) as the default value, and save. You will find then in a data-input form that the date will be automagically filled in as chosen.

OK??

There is a kexi mailing list on the kexi site, the posts are reflected on

http://<email address hidden>/

bestest
anotheranne

Revision history for this message
LordMax (lordmax) said :
#4

Yep.
Thanks, really thanks for your support.

But what append when the day change?

If I put 04/10/2010 in the default value I get the right value for all the day but when it's 11?
I can't manually change all the default properties of all tables
^____^

In Access, and in mysql etc, I can put a value that say "today" whichever today is

Revision history for this message
Anne Wainwright (anotheranne) said :
#5

The flippant answer is change the default tomorrow and save :(

I made a test database to check this out and now find I cannot get rid of the default date!

The default date is coded into the database schema as can be verified by looking at the database SQL create statement outside of Kexi (with something like SQLite Database Browser). Thus the date is not stored in kexi per se. I am not sure how to get rid of this.

So the quick way is to delete and recreate the table from scratch and not enter any default which puts you back where you were but with no data. So export the data first and you can then import it back.

Like yourself, I see no support for entering something like 'today'. Whereas you have an inbuilt language like VisualBasic (?) in Access, or ObjectPal in Paradox to attach to objects, there is no such thing in Kexi.

At this point I suspect the answer is that you would have to write a Python script (ie for a 'New Record' button on a data entry form) to handle this date issue, but as a perl person I am not looking at playing with Python.

Kexi2 which is a major step up is promised shortly and hopefully this will be more of a finished product.

Sorry if I can't help you much using the embedded sqlite option (using postgresql).

anotheranne

Revision history for this message
LordMax (lordmax) said :
#6

It seem that Kexi don't accept standard SQL value.
SqLite had some standard value like: CURRENT_TIME, CURRENT_DATE and CURRENT_TIMESTAMP
(http://www.sqlite.org/lang_createtable.html) that's what I'll need for my database.

If I can't make this I can't use Kexi and it's really a sin.

Thanks for you precious help

Revision history for this message
Anne Wainwright (anotheranne) said :
#7

If you make a Kexi query you can enter SQL statements like "CURRENT_DATE" in the design view mode. Then you will see the complete SQL query incorporating the statement in the SQL text view mode which will parse it as OK, have just done such a query.

So SQL statements can certainly be passed through kexi. Therefore you are only a step away from success.Sharpen Python skills and script your own 'today' to a "New Record" button.

I am personally disappointed that Perl is not catered for in the scripting framework for KDE, but that's not the end of the world (only a gross error!). Point is we have to adapt to doing things a different way.

M$ and Borland embedded a whole language into their DBMS products. With open source this is not done in quite the same way. Existing languages such as perl, python, and others are well adapted to scripts and thus applications like kexi make provision to use them. In this case Python is likely the way to go at the moment. I don't know what Kexi2 holds for us, but this is a serious upgrade to a whole new level that may well solve all our problems (ever optimistic).

anotheranne

Revision history for this message
LordMax (lordmax) said :
#8

Great.
Thanks really.

I'll try with python hoping that's all good in the new release. ^___^