Data not recorded in a table in a database

Discuss the database features

Data not recorded in a table in a database

Postby Victor Reis » Wed Jul 28, 2010 3:27 am

Please my apologies if this question is repeated.
I have a database in which I put data through a form, so these data are recorded in a table. When I put the data in a form and then get out of the database, they are not recorded in a table. The data are recorded only when I enter and leave in the table at least once. If i did not enter in the table the data are lost. How do I solve this? Please help me i use this database on my work. I have Broffice 3.2 on windows 7.

Excuse me for my English, I'm Brazilian.

Victor Reis
OpenOffice 3.2 on Windows 7
Victor Reis
 
Posts: 9
Joined: Wed Jul 28, 2010 3:04 am

Re: Data not recorded in a table in a database

Postby r4zoli » Wed Jul 28, 2010 7:50 am

Please give us more details, best is if you add your file to your post, without data.
AOO 4.0 and LibO 4 on Win 8
Hungarian forum co-admin
User avatar
r4zoli
Volunteer
 
Posts: 2882
Joined: Mon Nov 19, 2007 8:23 pm
Location: Budapest, Hungary

Re: Data not recorded in a table in a database

Postby Victor Reis » Wed Jul 28, 2010 3:20 pm

Dear r4zoli,

Thank you for your help, the file that i use in my work (part of it) is attached in this message in zip format.
Just when I click on the file named "Biblioteca", it opens a full screen form named "SISFORM", in this form I click on the button named "Ficha de atendimento" and it opens another form named "FORMULARIO_GERAL". The data related to attendance at my job are placed in this form, at the end of this form the person clicks the button named "CONCLUÍDO", this button has the action to include a new record. When all this procedure is done then at the end of day i close the program (Broffice 3.2) but the data included are not saved. The data are saved only if I enter, at least once, in the table named "TABELA GERAL" that receives the data filled in form. Is there any solution? I appreciate any help.
Sorry for mistakes in English language I am Brazilian.
Victor Reis
Attachments
Biblioteca.zip
(117.04 KiB) Downloaded 291 times
OpenOffice 3.2 on Windows 7
Victor Reis
 
Posts: 9
Joined: Wed Jul 28, 2010 3:04 am

Re: Data not recorded in a table in a database

Postby r4zoli » Wed Jul 28, 2010 3:47 pm

I tested with OOo 3.2.1, and it works.

If you could update to OOo 3.2.1, 3.2 version has several bugs connected to Base forms.
AOO 4.0 and LibO 4 on Win 8
Hungarian forum co-admin
User avatar
r4zoli
Volunteer
 
Posts: 2882
Joined: Mon Nov 19, 2007 8:23 pm
Location: Budapest, Hungary

Re: Data not recorded in a table in a database

Postby Victor Reis » Wed Jul 28, 2010 7:01 pm

Dear r4zoli,

I´m using Broffice 3.2.1 on windows 7 and these defects still ocurr, i´ve changed this version to Ooo 3.2.1 (in English) and i discuss what will happen. A macro to open and close a table could be a solution? how do I do?
Thank you for your great help.

Victor Reis
OpenOffice 3.2 on Windows 7
Victor Reis
 
Posts: 9
Joined: Wed Jul 28, 2010 3:04 am

Re: Data not recorded in a table in a database

Postby RPG » Wed Jul 28, 2010 7:58 pm

Hello

It is also working for me.

It is not clear for me if all data is lost of only for one record?

A solution for losing the last record can be; make a button in your form for closing the form.

action :openDocument/webpage
url: .uno:CloseDoc

When your form is closed then it will ask you for saving and you have to say YES. But this happens also in normal condition. Not your form is saved only the current records when it is changed.

Maybe you can make first a control toolbar for testing. then all buttons are on the toolbar

Romke
LibreOffice 6.1.5.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2164
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Data not recorded in a table in a database

Postby Victor Reis » Wed Jul 28, 2010 9:41 pm

I tested Ooo 3.2.1(in English) on Windows 7 and i realized that while the Ooo 3.2.1 is open or even when we close the Ooo 3.2.1, it appears a file with the ".lck" extension, in my case is "Biblioteca.odb.lck". While this file (*.lck) is open all data is apparently recorded, but when we insert the data and turn off the computer data are not recorded. This is big problem for me because my boss is not happy with me. Please, how can i solve this?

Victor Reis
OpenOffice 3.2 on Windows 7
Victor Reis
 
Posts: 9
Joined: Wed Jul 28, 2010 3:04 am

Re: Data not recorded in a table in a database

Postby Victor Reis » Wed Jul 28, 2010 10:47 pm

Dear r4zoli and RPG,

I tried to put this url (.uno:CloseDoc) on the button at the end of form but apparently the data are recorded while the program is opened and computer is turn on. When I insert data in the form and click on the button "CONCLUÍDO" with ".uno:CloseDoc" i save the changes, then close form, also Ooo 3.2.1 and turn off computer but when i turn on computer the data are not recorded. What do you think. Can you help me please?

Victor Reis
OpenOffice 3.2 on Windows 7
Victor Reis
 
Posts: 9
Joined: Wed Jul 28, 2010 3:04 am

Re: Data not recorded in a table in a database

Postby RPG » Wed Jul 28, 2010 11:23 pm

Hello

I did have made a navigation control in the form and when I press on the button save record it works better then new record. For that reason I think make first a navigation control in your form and test what is working.

Romke
LibreOffice 6.1.5.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2164
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Data not recorded in a table in a database

Postby RPG » Wed Jul 28, 2010 11:56 pm

Hello

How do you open the forms with the normal database?
Are that embedded forms?
Open you the embedded forms from outside the database?
When yes: this is not possible

Romke
LibreOffice 6.1.5.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2164
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Data not recorded in a table in a database

Postby Victor Reis » Thu Jul 29, 2010 4:12 am

Dear RPG,

To open my database I click on the icon of the file itself named "Biblioteca", i don´t use extensions of OpenOffice (Desktop Shortcut) and my form named "Formulario_geral" is connected with table named "Tabela geral". In the footnote on default screen of Base is written that database is embedded. Did you tried to insert data on the form "Formulario_Geral" then click on buttom that save changes and then exit the Openoffice and turn off the computer and after turn on the computer to see if the data was recorded? Thanks a lot.

Victor Reis
OpenOffice 3.2 on Windows 7
Victor Reis
 
Posts: 9
Joined: Wed Jul 28, 2010 3:04 am

Re: Data not recorded in a table in a database

Postby r4zoli » Thu Jul 29, 2010 7:54 am

I added data yesterday, started computer today and all yesterday inserted data can be found in table.
AOO 4.0 and LibO 4 on Win 8
Hungarian forum co-admin
User avatar
r4zoli
Volunteer
 
Posts: 2882
Joined: Mon Nov 19, 2007 8:23 pm
Location: Budapest, Hungary

Re: Data not recorded in a table in a database

Postby RPG » Thu Jul 29, 2010 9:55 am

Hello

I think this is a good time to redesign your complete database.
a) start with a not embedded database.
An embedded database a perfect method to loose on sometime your complete database.

b) Start with using not embedded forms
You clearly want not see the database. Not embedded forms are normal writer documents

c) start study and not only read some tutorials about OOo-base and the database engine of your choice.

I think when you have do the aboce step then there is a change that your problem is also solved.

I think also start with building a good working forms before you work to the design only.

Romke
LibreOffice 6.1.5.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2164
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Data not recorded in a table in a database

Postby Victor Reis » Thu Jul 29, 2010 7:16 pm

Dear RPG,

I'll follow your advice to improve my database, thanks for your help. Get bibliographies in portuguese that teaches using Ooo-Base is a little difficult here in Brazil. I just found one book, in the version Ooo 2.0, in a web site. Do you know how I can open and close a table through some macro? This could help me at least for now. Again thank you for your help.

Victor Reis
OpenOffice 3.2 on Windows 7
Victor Reis
 
Posts: 9
Joined: Wed Jul 28, 2010 3:04 am

Re: Data not recorded in a table in a database

Postby RPG » Thu Jul 29, 2010 9:40 pm

Hello

I think it is not a problem of the table but of the datasource. But I'm not sure about it. Also I don't on this moment not any thing about closing a table but knew how to flush the data. Do test it before you trust it. there I have not test in the way you need the code. I have samples and it is to you how to use it.

Maybe this link can help you

I hope this help you


Romke


Code: Select all   Expand viewCollapse view
sub FlushdataDirect
' this must be activate
dim oda,oControl
oDa=Thisdatabasedocument ' This is the model of the database
oControl=oDa.currentcontroller 'This is the  controller of the database
oControl.datasource.flush
end sub


sub flushdataWithButton(oEvent as object)
'activate this with a button in your form
dim oForm
oForm=oEvent.source.model.parent
oForm.Activeconnection.parent.flush ' Goes from the form to the connection.
' The connection is part of the datasource and then flush
end sub
LibreOffice 6.1.5.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2164
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Data not recorded in a table in a database

Postby Victor Reis » Fri Jul 30, 2010 5:54 pm

Dear RPG,

Thanks! Now, the database is recording the data!
I used the second macro you posted. I realized that the form was not loading (flushing) data in the table, perhaps because it was opened by a macro. Could you explain me what the difference between the two macros you posted? I don´t undestand it rigth.

Again thanks so much! You saved my job.

Victor Reis
OpenOffice 3.2 on Windows 7
Victor Reis
 
Posts: 9
Joined: Wed Jul 28, 2010 3:04 am

Re: Data not recorded in a table in a database

Postby RPG » Fri Jul 30, 2010 6:07 pm

Hello

I did found after some testing that I lose data when I close the database. I can also repeat it.

The method was as follow
a) close first OpenOffice.org complete
b) start the database up from the file by clicking on filename.odb
c) Fill in some form
d) close the fill in form of the database
e) exit the front page of this database
f) result there is no data stored.

I think this is an unusal way of working in OOo-base but I think it is a bug of OOo-base. Maybe r4zoli knew more about this.

A work around can maybe be this. Save the most important form or more in a stand alone form. Now I can see the error, we can work for a more easy solution.

The question you asks comes later but I'm glad it is working for you.

Romke
LibreOffice 6.1.5.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2164
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Data not recorded in a table in a database

Postby RPG » Sun Aug 01, 2010 12:16 am

Hello

The reason why the data is not stored when you exit OOo is not you start it with a macro. I think when you exit OOo then there is not enough checking if there must be stored some data.

I have found a place where you can bound an event and then can flush the data. It seems enough when I did test it but we never know.
It is an event of the databasedocument: View is going to be closed
This is four below the event you use for opening the first document.
Code: Select all   Expand viewCollapse view
sub StoreData
' This must be bound to the database documnet.
' view is going to be closed
if  Thisdatabasedocument.currentcontroller.isConnected=true then
      Thisdatabasedocument.currentcontroller.datasource.flush
      'Thisdatabasedocument.datasource.flush
   else
      msgbox "You cannot flush data from a database who is notconnected"
end if
end sub




The different between the two macro is not big. The most important is the word flush. The other part are important you cannot freely choose it. You have an object for starting and then search for what you need.
In this case I can start from thre different object
a) Thisdatabasedocument
b) The event of the button
c) Thiscomponent.

The first two I'm sure I can reach the flsuh now I have to search for the route. And then how more you work with something how moreyou knew in this case of OOo. The reason why one is not working I don't know but this can depend of some little things as where do you store the macros or others reason like the way of testing.

Romke
LibreOffice 6.1.5.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2164
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Data not recorded in a table in a database

Postby Victor Reis » Mon Aug 02, 2010 10:14 pm

Dear RPG,

Many thanks for the explanation of the macros posted by you. Is there any place online that teaches how to build the codes of the macros? Besides, you know any macro that opens any file, for example a *.mp3? I want to use some vocal recordings by clicking a button or open a document.

Victor Reis
OpenOffice 3.2 on Windows 7
Victor Reis
 
Posts: 9
Joined: Wed Jul 28, 2010 3:04 am

Re: Data not recorded in a table in a database

Postby RPG » Mon Aug 02, 2010 11:49 pm

Hello

There is good information about macros but this information is more for making real difficult code. For the more easy code there is no information. What do I mean for easy code: When you use forms or documents then the macros can be more easy. When you want use macros in documents then it is real important to understand the service and interfaces. I think for the most users it is more important to understand SQL and howto program with forms then learning to prgram macro's. When you want use easy macros, use then the BaseTools of Benitez. When you need little macros for calc or writer I think most can you find on the forums.

For your information you can make forms in Impress each page can be a form. The same is true for Calc. When you use forms who are not embedded in a database then the macros are a little different.

I have done a little test and with a button you can play music. I done't know other methods but they can exist.
action: open webpage
url : point to mp3

Romke
LibreOffice 6.1.5.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2164
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Data not recorded in a table in a database

Postby vsp » Tue Sep 07, 2010 4:29 pm

This is actually quite a normal way to access a database. The product is built to enable it and many users actually do just that - double click on the database file.

There is also a bug when selecting a file from the recently used list - you don't always get the file you select. Both of these have cost me dearly and are the reason that I have aborted further development using base. It is fundamentally unreliable and too high a risk for business data. It might be OK for storing your CD list or personal addresses but for a business the loss of data can be catastrophic and suggestions that it is being used incorrectly just because people are taking advantage of provided functionality is unhelpful.

I have 25 years of I.T. experience and cover databases from DMSII, DBS, SQLServer, Access, MyBASE, Paradox and a host of others (including ISAM, Btree, Ttree etc) but have never come across anything so buggy as openoffice Base. Unless someone starts to take this seriously it is going to disappear completely.
OpenOffice 3.2.1 with MacOS 10.5.8
vsp
 
Posts: 12
Joined: Sun Aug 08, 2010 12:55 pm

Re: Data not recorded in a table in a database

Postby tdeleus » Thu Apr 14, 2011 2:06 pm

I have the same problem with my database.
I create a simple form to fill data in a table (so I can use a list box for some items), and have a macro that opens the form at startup.
I add a record,
click on the "save record" button in the navigation toolbar.
Then I leave the form and close openoffice.
When I reopen the database, the data is lost (it is not saved - also the ).
To me it seems quite normal way to use the product (I agree with vsp on this) for small application at home.
Are there plans to solve this strange behavor?

Thanks,
Tomas
OpenOffice 3.3
WindowsXP
Mac OS 10.6
tdeleus
 
Posts: 3
Joined: Thu Apr 14, 2011 1:49 pm

Re: Data not recorded in a table in a database

Postby RoryOF » Thu Apr 14, 2011 2:18 pm

Victor Reis wrote:Dear RPG,

Many thanks for the explanation of the macros posted by you. Is there any place online that teaches how to build the codes of the macros? Besides, you know any macro that opens any file, for example a *.mp3? I want to use some vocal recordings by clicking a button or open a document.

Victor Reis


The main source for macro programming for OpenOffice is Andrew Pitonyak's site
http://www.pitonyak.org/oo.php
Apache OpenOffice 4.1.6 on Xubuntu 18.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 28986
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Data not recorded in a table in a database

Postby tdeleus » Thu Apr 14, 2011 3:12 pm

I attached the file.
The values have no meaning, but I left the records because I don't remember seeing the problem initially.

To reproduce:
open the file
-> a start form opens with 6 buttons
Press the "Entrar gastos" button
-> this opens the F_gastos form
Go to the last record
Click on the next line to start entering a new record
Enter the date (Fecha)
Select a value from the list in the "Rubro" field
Add 2 (or another number") in the "Monto" field.
Press the "Save record" button in the navigation toolbar. It will grey-out, so it should have saved.
Close the form (pressing the X at right top)
Close OpenOffice (pressing X at the right top)

You can notice now that in the file-manager the Date Modified did not change (I think it should have changed when saving the record)

open the database again.
Goto the same form and check the records, it is not there.
If you check the table gastos, you will see it is not there neither.

I know the code in the macros is probably not very good code, but the "Save record" of the navigation toolbar is standard and I expected it to save the record to disk.

Thanks for any sugestion,

Tomas
Attachments
gastos.odb
(99.57 KiB) Downloaded 251 times
tdeleus
 
Posts: 3
Joined: Thu Apr 14, 2011 1:49 pm

Re: Data not recorded in a table in a database

Postby RPG » Thu Apr 14, 2011 3:19 pm

Hello

When you make stand alone forms then you have not this problem.

There are several good tutorials about programming is OpenOffice.org basic. My personal experience was they are to difficult for starters. It cost me a lot of time to understand how I could use the examples also it was real difficult to understand what the different service an interfaces all did. What I see on this forum most people want only some subroutines and not a lot code. I think for most people it can be real important to learn more about OOo as suite then learning about macros. I have the idea a lot of people start first with macros and then try to learn the suite.

In this case there same me no reason to use macros then you have also not the problem describe in this thread. You have only to use stand alone forms.

I like some searching new code when I found good code then I always post that information. It is not always good to understand for beginners.


How to avoid the dataloss
Also I will give the same information again but maybe it is more readable.

When you open a database by double clicking and open also a form then it is possible then not all connection are made.
This part you can use when the databasedoucment opens. Use the event: OpenDocument
Code: Select all   Expand viewCollapse view
with Thisdatabasedocument.currentcontroller
   if  not .isConnected then  .connect
end with



This part you have to use when the database is closed. I bind it to the event: View Closed
Code: Select all   Expand viewCollapse view
Thisdatabasedocument.currentcontroller.datasource.flush


Where do you find the event.

The event are part of the database document. There where you can see the forms names and tablesnames.

menu --> tools --> customize.

the fourth from above : Open Document.
the nineth ( 9) from above : View closed.

I have this copied from here.

Romke
LibreOffice 6.1.5.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2164
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Data not recorded in a table in a database

Postby RPG » Thu Apr 14, 2011 3:32 pm

Hello

Maybe this can help you for shorter code for open a form.

Romke
LibreOffice 6.1.5.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2164
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Data not recorded in a table in a database

Postby tdeleus » Fri Apr 15, 2011 11:26 am

Romke,
the code above works. Thanks!!

Still i think it is a strange hidden feature that could people make abandon openoffice if you just want to try it quickly without going thru manuals....
OpenOffice 3.3
WindowsXP
Mac OS 10.6
tdeleus
 
Posts: 3
Joined: Thu Apr 14, 2011 1:49 pm

Re: Data not recorded in a table in a database

Postby RPG » Fri Apr 15, 2011 12:13 pm

Hello

I think when it is a bug then it is not such an important bug. When you write macros then it is important not to read quickly tutorials.

Romke
LibreOffice 6.1.5.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2164
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands


Return to Base

Who is online

Users browsing this forum: No registered users and 3 guests