Re: [api-dev] How to change the "ActiveConnection" of a already opened Form
Fernand Vanrie a écrit : Hi Fernand, and Frank, >> > OK I can follow so far, but can you see a other strategie to keep the > users away from Tables and other Datbase stuff where valid > information like Paswords etc... are been stored ? > I was thinking on > - Stroring the forms in a WritterDoc ? > - open a OO-base-doc in a "hidden" way ? > - multi-user aces to one OO-base-doc (because one of the main > problems is to distribute several Docs who are needed to run 1 > application) This is something that would interest me too. At the moment, I have terrible admin headaches trying to control what people do with their respective ODB files, and it would be nice to be able to have a concurrently multiple user accessible ODB file that I could store on my file server, and which would know how to recognize : (a) EITHER the individual rights of a given user to modify or create new forms, queries or reports (b) OR the means to store, at the user configuration level, the user's own queries, reports, etc. The current implementation of the ODB document as a container does not allow for such scenarii, to my knowledge. At the moment, I have to store my forms outside of the document. If the user's ODB document gets corrupted, destroyed or there is just a plain version mismatch, then you can not simply copy someone elses ODB and expect the forms to work properly. I have just had to go through that nightmare where we spent 3 rather unproductive hours trying to understand why a separate form which worked perfectly for some people did not work for others despite the fact that they all had, in appearance, a linked ODB document (for establishing the connection) with the same name, appropriate user rights and usage parameters. Alex - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to change the "ActiveConnection" of a already opened Form
Hi Fernand, > OK I can follow so far, but can you see a other strategie to keep the > users away from Tables and other Datbase stuff where valid information > like Paswords etc... are been stored ? > I was thinking on > - Stroring the forms in a WritterDoc ? that would completely avoid the problem of embedding forms not being prepared for alien connections, yes. At the cost of additional administration, of course. Perhaps the easiest way here is to simply take the form, copy it to a stand-alone document, and load this one - in this case, the ActiveConnection parameter should work as you expect it. > - open a OO-base-doc in a "hidden" way ? Should work, too, though I never played with this. Ciao Frank -- - Frank Schönheit, Software Engineer frank.schoenh...@sun.com - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Base http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to change the "ActiveConnection" of a already opened Form
Frank Schönheit - Sun Microsystems Germany wrote: Hi Fernand, Also, in the scenario you described - two forms in the same database document - there should be no need at all to change the active connection of the already-loaded form. What do you want to achieve with this? Frank, thanks for the reply, the goal is to use OO as a front end for manupulating data in external Databases and using OO-docs for the output . Problem is to have 1 Doc where users have only acces to the Forms or reports and keep them as far as possible away from the Databases tables. etc... .. A few weeks ago Drew Jensen Gives me the folowing advice /Actually no you don't need 2 ODB files per user. When a form, query definition, or report, is opened from a script (basic, python or JavaScript macro) you pass an instance of an open connection object. Normally this is the Active connection for the ODB file, but it does not have to be. So, when the switchboard form loads it could create a second connection object. One that is connected to the MS SQLServer. Then when it loads the actual forms, etc., simply pass this second connection to the form. Okay, so your form is in an .odb file, but it shall work on a connection other than the one described by the database document. Hmm. Not sure I would call this a valid scenario :), since the assumption has always been that a form embedded in a database document uses the connection of this database document. The fact that the ActiveConnection of this document is/must-be passed when loading the form is more of an implementation detail, which normally should not be exposed to the API. That's the reason why the more recent XDatabaseDocumentUI.loadComponent, which is to be preferred over loadComponentFromURL, does not require the active connection, but calculates it itself. Anyway, since it seems loadComponentFromURL works (kind of), you can try proceeding with it. However, for "re-connecting" a form to a new connection, you will then need to close/re-open the form. Your other question, about the sub forms not getting the active connection, is harder. Without going into detail, I in fact think the problem is the ActiveConnection used by the master form, which does not belong to the embodying database document. I can't think of a clean solution, but you could use an ugly workaround like this: a) Remove the sub form from its parent b) change its ActiveConnection property c) re-insert the sub form into its parent. You might write an RFE requesting that the sub forms also use the ActiveConnection passed while loading - finally, it could be considered a bug that they currently don't. However, I would need more thinking about the potential side effects of running an embedded form with an alien connection. In the worst case, this could lead to the conclusion that an ActiveConnection being different from the current connection of the application window is forbidden at all ... OK I can follow so far, but can you see a other strategie to keep the users away from Tables and other Datbase stuff where valid information like Paswords etc... are been stored ? I was thinking on - Stroring the forms in a WritterDoc ? - open a OO-base-doc in a "hidden" way ? - multi-user aces to one OO-base-doc (because one of the main problems is to distribute several Docs who are needed to run 1 application) Greetz Fernand Ciao Frank - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to change the "ActiveConnection" of a already opened Form
Hi Fernand, >> Also, in the scenario you described - two forms in the same database >> document - there should be no need at all to change the active >> connection of the already-loaded form. What do you want to achieve with >> this? >> > Frank, thanks for the reply, the goal is to use OO as a front end for > manupulating data in external Databases and using OO-docs for the output > . Problem is to have 1 Doc where users have only acces to the Forms or > reports and keep them as far as possible away from the Databases > tables. etc... .. A few weeks ago Drew Jensen Gives me the folowing advice > > /Actually no you don't need 2 ODB files per user. > > When a form, query definition, or report, is opened from a script > (basic, python or JavaScript macro) you pass an instance of an open > connection object. Normally this is the Active connection for the ODB > file, but it does not have to be. > > So, when the switchboard form loads it could create a second connection > object. One that is connected to the MS SQLServer. Then when it loads > the actual forms, etc., simply pass this second connection to the form. Okay, so your form is in an .odb file, but it shall work on a connection other than the one described by the database document. Hmm. Not sure I would call this a valid scenario :), since the assumption has always been that a form embedded in a database document uses the connection of this database document. The fact that the ActiveConnection of this document is/must-be passed when loading the form is more of an implementation detail, which normally should not be exposed to the API. That's the reason why the more recent XDatabaseDocumentUI.loadComponent, which is to be preferred over loadComponentFromURL, does not require the active connection, but calculates it itself. Anyway, since it seems loadComponentFromURL works (kind of), you can try proceeding with it. However, for "re-connecting" a form to a new connection, you will then need to close/re-open the form. Your other question, about the sub forms not getting the active connection, is harder. Without going into detail, I in fact think the problem is the ActiveConnection used by the master form, which does not belong to the embodying database document. I can't think of a clean solution, but you could use an ugly workaround like this: a) Remove the sub form from its parent b) change its ActiveConnection property c) re-insert the sub form into its parent. You might write an RFE requesting that the sub forms also use the ActiveConnection passed while loading - finally, it could be considered a bug that they currently don't. However, I would need more thinking about the potential side effects of running an embedded form with an alien connection. In the worst case, this could lead to the conclusion that an ActiveConnection being different from the current connection of the application window is forbidden at all ... Ciao Frank -- - Frank Schönheit, Software Engineer frank.schoenh...@sun.com - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Base http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to change the "ActiveConnection" of a already opened Form
Frank Schönheit - Sun Microsystems Germany wrote: Hello Fernand, I trye to pass a nwe connection to a already opened form document who contains the macro a running from. You cannot do this. ActiveConnection is only accepted when the form is being loaded, after that, any change to it is vetoed, since the assumption is that the form, living in the database document, always uses the connection which the main database window already established. Also, in the scenario you described - two forms in the same database document - there should be no need at all to change the active connection of the already-loaded form. What do you want to achieve with this? Frank, thanks for the reply, the goal is to use OO as a front end for manupulating data in external Databases and using OO-docs for the output . Problem is to have 1 Doc where users have only acces to the Forms or reports and keep them as far as possible away from the Databases tables. etc... .. A few weeks ago Drew Jensen Gives me the folowing advice /Actually no you don't need 2 ODB files per user. When a form, query definition, or report, is opened from a script (basic, python or JavaScript macro) you pass an instance of an open connection object. Normally this is the Active connection for the ODB file, but it does not have to be. So, when the switchboard form loads it could create a second connection object. One that is connected to the MS SQLServer. Then when it loads the actual forms, etc., simply pass this second connection to the form. In fact this also allows you to use getIsolatedConnection (versus getConnection) to create a connection that supports AUTO_COMMIT = False if you need to - this allows you full control for committing or rolling back updates as needed, for instance: multiple table updates as a single business transaction. (This same trick works for an embedded HSQL database by the way) You will probably want to use two ODB files when you are building the application, but a final step before pushing out to your users will be a merge of the forms, query def's, reports into the single ODB file that you would distribute. Taking this one step then, you can have forms and or statements in scripts that work with local (embedded HSQL) tables in the same ODB file then - a nice way to offer user specific configuration or history data in your database. I hope that helps, Drew ps - sure looks like a ripe candidate for a sm/ all example project, doesn't it. Greetz and a Happy and Succes full New Year for you and your Familly Fernand Ciao Frank - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to change the "ActiveConnection" of a already opened Form
Hello Fernand, > I trye to pass a nwe connection to a already opened form document who > contains the macro a running from. You cannot do this. ActiveConnection is only accepted when the form is being loaded, after that, any change to it is vetoed, since the assumption is that the form, living in the database document, always uses the connection which the main database window already established. Also, in the scenario you described - two forms in the same database document - there should be no need at all to change the active connection of the already-loaded form. What do you want to achieve with this? Ciao Frank -- - Frank Schönheit, Software Engineer frank.schoenh...@sun.com - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Base http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to change the "ActiveConnection" of a already opened Form
Marc, when trie changing the ActiveConnection I run in a PropertyVeto exception so: oForm.ActiveConnection = newConnectionand oForm.SetPropertyvalue("ActiveConnection" , newconnection) are not working Marc Santhoff wrote: Am Dienstag, den 23.12.2008, 15:05 +0100 schrieb Fernand Vanrie: Marc, Thanks for the quick reply, I saw now that I actualy was using "_blank" in my test envoriment. I have to investigate further this diverences, because using "_default blocs the frame and I Have to restart to kill the frame. and OO But sorry: " _blank" makes no difference :-) I'm starting to think using "loadComponentFromURL" is not the right method of exchanging the Connection. There is a trick reagarding reusing open frames by handing over the frame and naming the model in the args() (or the other way round ;), but I'm unable to find it currently. Isn't it possible to directly set the "Connection" property of the form to the new connection and do a reload of the data? sth. like: Formdoc1.Connection = MynewConnection Formdoc1.reload() ' or .refresh() Marc Have a merry christmas you to fernand Marc Santhoff wrote: Am Dienstag, den 23.12.2008, 12:06 +0100 schrieb Fernand Vanrie: Hallo All, I trye to pass a nwe connection to a already opened form document who contains the macro a running from. So i have a Base Doc with 2 Form Docs. Mi macro resists and is run from formdoc1 with the macro I trie to pass a new connection to formdoc1 with the use of the function below i can easly pass a new connection to my not opened Formdoc2 But using this function (sort of "reloading"of Formdoc1 ) passes but the connection is not changed. function OpenForm( formContainer as variant, oConnection as variant, sFormName as string) 'as variant Dim aProp(1) As New com.sun.star.beans.PropertyValue aProp(0).Name = "ActiveConnection" aProp(0).Value = MynewConnection aProp(1).Name = "OpenMode" aProp(1).Value = "open" Try using OpenForm = .loadComponentFromURL(sFormname,"_blank",0,aProp()) "_default" here. According to the dev guide "_blank" requests a new blank frame, "_default" reuses the already open one. end function so: Can I change the Activeconention in my Formdoc1 ? thanks for any hint Fernand HTH, and have a merry christmas without too much work ;), Marc - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to change the "ActiveConnection" of a already opened Form
Am Dienstag, den 23.12.2008, 15:05 +0100 schrieb Fernand Vanrie: > Marc, > > Thanks for the quick reply, I saw now that I actualy was using "_blank" > in my test envoriment. I have to investigate further this diverences, > because using "_default blocs the frame and I Have to restart to kill > the frame. and OO > But sorry: " _blank" makes no difference :-) I'm starting to think using "loadComponentFromURL" is not the right method of exchanging the Connection. There is a trick reagarding reusing open frames by handing over the frame and naming the model in the args() (or the other way round ;), but I'm unable to find it currently. Isn't it possible to directly set the "Connection" property of the form to the new connection and do a reload of the data? sth. like: Formdoc1.Connection = MynewConnection Formdoc1.reload() ' or .refresh() Marc > Have a merry christmas you to > > fernand > > > > > Marc Santhoff wrote: > > Am Dienstag, den 23.12.2008, 12:06 +0100 schrieb Fernand Vanrie: > > > >> Hallo All, > >> > >> I trye to pass a nwe connection to a already opened form document who > >> contains the macro a running from. > >> > >> So i have a Base Doc with 2 Form Docs. > >> > >> Mi macro resists and is run from formdoc1 with the macro I trie to pass > >> a new connection to formdoc1 > >> > >> with the use of the function below i can easly pass a new connection to > >> my not opened Formdoc2 But using this function (sort of "reloading"of > >> Formdoc1 ) passes but the connection is not changed. > >> > >> function OpenForm( formContainer as variant, oConnection as variant, > >> sFormName as string) 'as variant > >> Dim aProp(1) As New com.sun.star.beans.PropertyValue > >> aProp(0).Name = "ActiveConnection" > >> aProp(0).Value = MynewConnection > >> aProp(1).Name = "OpenMode" > >> aProp(1).Value = "open" > >> > > > > Try using > > > > > >> OpenForm = .loadComponentFromURL(sFormname,"_blank",0,aProp()) > >> > > "_default" > > > > here. According to the dev guide "_blank" requests a new blank frame, > > "_default" reuses the already open one. > > > > > >> end function > >> > >> > >> so: Can I change the Activeconention in my Formdoc1 ? > >> > >> thanks for any hint > >> Fernand > >> > > > > HTH, and have a merry christmas without too much work ;), > > Marc > > > > > > > > - > > To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org > > For additional commands, e-mail: dev-h...@api.openoffice.org > > > > > - > To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org > For additional commands, e-mail: dev-h...@api.openoffice.org > - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to change the "ActiveConnection" of a already opened Form
Marc, Thanks for the quick reply, I saw now that I actualy was using "_blank" in my test envoriment. I have to investigate further this diverences, because using "_default blocs the frame and I Have to restart to kill the frame. and OO But sorry: " _blank" makes no difference :-) Have a merry christmas you to fernand Marc Santhoff wrote: Am Dienstag, den 23.12.2008, 12:06 +0100 schrieb Fernand Vanrie: Hallo All, I trye to pass a nwe connection to a already opened form document who contains the macro a running from. So i have a Base Doc with 2 Form Docs. Mi macro resists and is run from formdoc1 with the macro I trie to pass a new connection to formdoc1 with the use of the function below i can easly pass a new connection to my not opened Formdoc2 But using this function (sort of "reloading"of Formdoc1 ) passes but the connection is not changed. function OpenForm( formContainer as variant, oConnection as variant, sFormName as string) 'as variant Dim aProp(1) As New com.sun.star.beans.PropertyValue aProp(0).Name = "ActiveConnection" aProp(0).Value = MynewConnection aProp(1).Name = "OpenMode" aProp(1).Value = "open" Try using OpenForm = .loadComponentFromURL(sFormname,"_blank",0,aProp()) "_default" here. According to the dev guide "_blank" requests a new blank frame, "_default" reuses the already open one. end function so: Can I change the Activeconention in my Formdoc1 ? thanks for any hint Fernand HTH, and have a merry christmas without too much work ;), Marc - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to change the "ActiveConnection" of a already opened Form
Am Dienstag, den 23.12.2008, 12:06 +0100 schrieb Fernand Vanrie: > Hallo All, > > I trye to pass a nwe connection to a already opened form document who > contains the macro a running from. > > So i have a Base Doc with 2 Form Docs. > > Mi macro resists and is run from formdoc1 with the macro I trie to pass > a new connection to formdoc1 > > with the use of the function below i can easly pass a new connection to > my not opened Formdoc2 But using this function (sort of "reloading"of > Formdoc1 ) passes but the connection is not changed. > > function OpenForm( formContainer as variant, oConnection as variant, > sFormName as string) 'as variant > Dim aProp(1) As New com.sun.star.beans.PropertyValue > aProp(0).Name = "ActiveConnection" > aProp(0).Value = MynewConnection > aProp(1).Name = "OpenMode" > aProp(1).Value = "open" Try using > OpenForm = .loadComponentFromURL(sFormname,"_blank",0,aProp()) "_default" here. According to the dev guide "_blank" requests a new blank frame, "_default" reuses the already open one. > end function > > > so: Can I change the Activeconention in my Formdoc1 ? > > thanks for any hint > Fernand HTH, and have a merry christmas without too much work ;), Marc - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
[api-dev] How to change the "ActiveConnection" of a already opened Form
Hallo All, I trye to pass a nwe connection to a already opened form document who contains the macro a running from. So i have a Base Doc with 2 Form Docs. Mi macro resists and is run from formdoc1 with the macro I trie to pass a new connection to formdoc1 with the use of the function below i can easly pass a new connection to my not opened Formdoc2 But using this function (sort of "reloading"of Formdoc1 ) passes but the connection is not changed. function OpenForm( formContainer as variant, oConnection as variant, sFormName as string) 'as variant Dim aProp(1) As New com.sun.star.beans.PropertyValue aProp(0).Name = "ActiveConnection" aProp(0).Value = MynewConnection aProp(1).Name = "OpenMode" aProp(1).Value = "open" OpenForm = .loadComponentFromURL(sFormname,"_blank",0,aProp()) end function so: Can I change the Activeconention in my Formdoc1 ? thanks for any hint Fernand - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org