Autorefresh column

Discuss the database features

Autorefresh column

Postby mihmih » Wed Mar 06, 2019 12:49 pm

Hi,

I have a table in the subform, I would like to click on this table (get focus) and make autorefresh the sql command in one of the columns (list box). How can i get it? Thanks for help.
LibreOffice 4.2 on Windows7
mihmih
 
Posts: 103
Joined: Wed Feb 18, 2015 9:21 pm

Re: Autorefresh column

Postby UnklDonald418 » Wed Mar 06, 2019 7:07 pm

A table grid control on a subform does have an event When receiving focus, so a macro could be constructed using that event to locate the list box control, then one line of the macro, something like
Code: Select all   Expand viewCollapse view
oControl.refresh

would force the list box query to execute.
Without more detailed information on the form it would be difficult to give anything more specific.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.6 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1213
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Autorefresh column

Postby mihmih » Thu Mar 07, 2019 1:34 pm

Thanks for the answer, I will try to explain it in more detail...

So I have four tables: with contractors, with orders from contractors, with the products of the contractors and a junction table (ID, order ID, product ID). The table with the products contains the contractor's ID.

And the problem is a form with adding orders ... in this form i adds order data in the main form (the source is a table of orders), then I go to the subform (table), where i adds product data (the source is a junction table). The first column in this table is the list box, where from the drop-down list I select products from the product table (the source of this drop-down list is the product table). All I want is that this list should be limited only to the contractor that was selected from the drop-down list in the mainform on this form, where i adds order data.
LibreOffice 4.2 on Windows7
mihmih
 
Posts: 103
Joined: Wed Feb 18, 2015 9:21 pm

Re: Autorefresh column

Postby Villeroy » Thu Mar 07, 2019 1:41 pm

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27114
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Autorefresh column

Postby Villeroy » Thu Mar 07, 2019 3:35 pm

[Base, Python] Tiny Macro Refreshing Forms, List/Combo Boxes
together with viewtopic.php?f=100&t=94393 (cascading list boxes).

It would be easier if you could use a subform with a grid control instead of a list box.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27114
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Autorefresh column

Postby mihmih » Sat Mar 09, 2019 11:55 am

Thanks for the answer, but I have looked through all the forms in both databases ("movies" and "countries_city") and I do not see a similar situation to that described by me...
LibreOffice 4.2 on Windows7
mihmih
 
Posts: 103
Joined: Wed Feb 18, 2015 9:21 pm

Re: Autorefresh column

Postby F3K Total » Sat Mar 09, 2019 2:52 pm

Hello,
i tried to create a simple sample DB. If i got you right, products and orders depend on the contractor. I used a one-row-filter-table to store the contractors ID, then a linked-order-subform to display the contractor orders and finaly another linked subsubform to display/work on the junction tables content. The listbox in the products column of the table-control is filtered by contractors ID stored in the filter table.
Attachments
CONTRACTORS_ORDERS.odb
(18.43 KiB) Downloaded 29 times
    MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
    my current system
  • Windows 7 OOo, AOO, LOLinux Mint OOo, AOO, LO
F3K Total
Volunteer
 
Posts: 914
Joined: Fri Dec 16, 2011 8:20 pm

Re: Autorefresh column

Postby mihmih » Sat Mar 09, 2019 6:10 pm

it looks like that's what I meant. thanks a lot .... if it could be done without the "set contractor"-button it would be perfect :)
LibreOffice 4.2 on Windows7
mihmih
 
Posts: 103
Joined: Wed Feb 18, 2015 9:21 pm

Re: Autorefresh column

Postby Villeroy » Sun Mar 10, 2019 12:48 am

Well this is just another trivial example of macro free "power filtering".

If you want to maculate this solution with a macro in order to save one click:
1) Install my AutoRefresh.py
2) Call the form navigator and move the "set contractor" button to the filtering parent form.
3) set its action from "Refresh" to "Save" and its default button property to Yes. Now it reacts on the enter key and saves the stored filter criterion in the filter table.
4) Add a hidden control to the filtering form. Name it AutoRefresh and set its value to F_ORDERS (name of the subform to be refreshed).
5) Assign macro My_Macros>pyDBA>AutoRefresh>form_Action to the filtering form's event "After record action". Now the macro will be triggered after the form has been saved and it will read the name of the subform to be refreshed from the hidden control. The same macro can refresh multiple forms, subforms, parent forms or any list boxes and comboboxes in all forms on the same form document.
Last edited by Villeroy on Mon Mar 11, 2019 4:19 pm, edited 1 time in total.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27114
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Autorefresh column

Postby mihmih » Mon Mar 11, 2019 3:06 pm

ok, I have a question, maybe a stupid question ...

For Python macros to work, python must be installed on my computer?
LibreOffice 4.2 on Windows7
mihmih
 
Posts: 103
Joined: Wed Feb 18, 2015 9:21 pm

Re: Autorefresh column

Postby Villeroy » Mon Mar 11, 2019 3:17 pm

It comes with your office.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27114
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Base

Who is online

Users browsing this forum: No registered users and 2 guests