OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Combo box
Goto page 1, 2  Next
 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
cowboy1611
General User
General User


Joined: 01 Nov 2011
Posts: 21

PostPosted: Fri Mar 23, 2012 6:20 am    Post subject: Combo box Reply with quote

Hello,
I think the combo box is my best choice for what I want to do.
I have it set up and it's working, but one thing more is needed.

I'd like to be able to keep new entries made in the combo box for future use.
i.e. Original list has name1, name2 name3 in the dropdown, but in the case where I enter name4, I'd like name4 to be insterted in the list for next time.

p.s. I'm not pulling the list entries from a file or DB, I initially populated it via
the Properties box under General and List entries.

Is there a selection I need to make to have this work ?
Back to top
View user's profile Send private message
dacm
Super User
Super User


Joined: 07 Jan 2010
Posts: 769

PostPosted: Fri Mar 23, 2012 7:15 am    Post subject: Reply with quote

You'll need to use an SQL content type ("Type of list contents") in your Combo Box Control, and simply fill the "List content" with a query of the same "Data field" using "Distinct"

Code:
SELECT DISTINCT "Title" FROM "Patient"


Perhaps see this demo:
http://user.services.openoffice.org/en/forum/viewtopic.php?p=225755#p225755

...
_________________
Soli Deo gloria
Tutorial: avoiding data loss with Base + Splitting 'Embedded databases'
Back to top
View user's profile Send private message
cowboy1611
General User
General User


Joined: 01 Nov 2011
Posts: 21

PostPosted: Fri Mar 23, 2012 10:02 am    Post subject: Reply with quote

Not sure about "You'll need to use an SQL content type ("Type of list contents"...)"
Per your demo, I'm not sure I have the same situation.

As I mentioned what I curenlty have in the Properties > General is a list that I've inserted manually into the "list entries" field.

My intention, is to select the combo box from the form, use the pull down to get the desired
entry, and be able (if the desired entry isn't currently listed) to type a new one into the field, which will in turn be added to the list for future use.
Back to top
View user's profile Send private message
dacm
Super User
Super User


Joined: 07 Jan 2010
Posts: 769

PostPosted: Fri Mar 23, 2012 11:05 am    Post subject: Reply with quote

cowboy1611 wrote:
My intention, is to select the combo box from the form, use the pull down to get the desired
entry, and be able (if the desired entry isn't currently listed) to type a new one into the field, which will in turn be added to the list for future use.

You may need to elaborate on which aspects of the suggestion and/or demo doesn't work as you've described. For instance, what is it about -- pulling-down the Title combo box in the demo, and either selecting from previous entries or typing-in a new entry, which is then automatically added to the list of Titles for future use upon saving the record -- that isn't working as you've described? I'm not perceiving the difference.
_________________
Soli Deo gloria
Tutorial: avoiding data loss with Base + Splitting 'Embedded databases'
Back to top
View user's profile Send private message
cowboy1611
General User
General User


Joined: 01 Nov 2011
Posts: 21

PostPosted: Fri Mar 23, 2012 11:25 am    Post subject: Reply with quote

Thanks for you patience, the light bulb just went on and it is working as advertised.

p.s. could this same type of thing be done in a "list box" ?

I have to situations, the one we've been discussing, where I want the flexibility to insert new items to the list as needed and another situation where the list is fixed.

My understanding is that I could/should use the "list box" for the latter ?
Back to top
View user's profile Send private message
dacm
Super User
Super User


Joined: 07 Jan 2010
Posts: 769

PostPosted: Fri Mar 23, 2012 11:48 am    Post subject: Reply with quote

cowboy1611 wrote:
...could this same type of thing be done in a "list box"...where the list is fixed.

Yes. You can have one Form that allows new entries via a Combo Box, and perhaps another Form that requires fixed values derived from those existing entries. In either case, use SQL in the same manner as outlined above. But for a List Box, simply SELECT the same field twice in the List content > Query builder dialog such that two columns appear in the result-set. With a List Box, the first column is displayed in the pull-down, while the second column is "bound" to the List Box's "Data field." So at least two columns are necessary in a bound List Box. Additional columns can be used for sorting or filtering the entries if necessary.
    EDIT: The List Box 'bound field' (which is saved to the assigned 'Data field') starts with the second column (designated/selected as 'bound field' = 1) up through Base version 3.3.0. Base 3.4 and newer will allow 'bound field' = 0 which means you can save the 'display field' to the assigned 'Data field' without the workaround of creating two, identical columns as mentioned above.

_________________
Soli Deo gloria
Tutorial: avoiding data loss with Base + Splitting 'Embedded databases'


Last edited by dacm on Thu Mar 29, 2012 9:31 am; edited 1 time in total
Back to top
View user's profile Send private message
cowboy1611
General User
General User


Joined: 01 Nov 2011
Posts: 21

PostPosted: Sat Mar 24, 2012 6:25 am    Post subject: Reply with quote

I forgot to ask in my previous post, is it possible, that once a field is pulled out from the list (Combo or List Box) to append it real time ?

e.g., I select Pie from the list but I also want to add Cherry, making the entry "Pie Cherry"
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Sat Mar 24, 2012 6:34 am    Post subject: Reply with quote

cowboy1611 wrote:
I forgot to ask in my previous post, is it possible, that once a field is pulled out from the list (Combo or List Box) to append it real time ?

e.g., I select Pie from the list but I also want to add Cherry, making the entry "Pie Cherry"

That's what the second refresh button on the toolbar does. It re-reads the contents of the currently focussed combo/list box control without reloading (and resetting) the entire form.
_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
Back to top
View user's profile Send private message
dacm
Super User
Super User


Joined: 07 Jan 2010
Posts: 769

PostPosted: Sat Mar 24, 2012 8:01 am    Post subject: Reply with quote

cowboy1611 wrote:
...append it real time...making the entry "Pie Cherry"

It will append the "Pie" entry for that particular record in all cases, thereby creating a "Pie Cherry" entry in the drop-down list-content. But it may or may not replace the "Pie" entry in that drop-down list. That depends on whether there is another "Pie" entry in any record in that column. Keep in mind that the List content is derived by SQL on-the-fly, so every time the control (combo box) is refreshed (perhaps by Villeroy's suggested technique), a new list is generated and displayed in the pulldown.

You can use Tools > SQL.. to issue an UPDATE command WHERE "Food" = 'Pie' as necessary to update all entries to "Pie Cherry". That will effectively replace "Pie" with "Pie Cherry" in the drop-down list. Or perhaps assign a Macro to a Button that triggers a Parameter Query (effectively creating a search and replace function)...
_________________
Soli Deo gloria
Tutorial: avoiding data loss with Base + Splitting 'Embedded databases'
Back to top
View user's profile Send private message
cowboy1611
General User
General User


Joined: 01 Nov 2011
Posts: 21

PostPosted: Mon Mar 26, 2012 7:17 am    Post subject: Reply with quote

Thanks, I'll play around with these options.

p.s.

I have a different situation I'd like to use, I'll create a list box and have fixed entries that I will install via the control>properties>gen tab where I'll insert the list manually in the "list entries" field.
I've tried this and it works fine, but I have a similar situation (like the pie cherry) where I want to append an entry after it's slelected from the listbox, I don't want to modify/append the list itself just the data entry that will go to the table..

e.g. I select "North" from a list of streets, once selected I want to ad the number
making it "North 22".
Currently, once North is selected I can't change the field.
Back to top
View user's profile Send private message
cowboy1611
General User
General User


Joined: 01 Nov 2011
Posts: 21

PostPosted: Thu Mar 29, 2012 5:43 am    Post subject: Reply with quote

To clarify my last post.

For this particular use, I don't want the list to change (it's fixed) based on additional appended input. Since the appends might only be a one time thing.

So, I want the list to come up, make my selection from the list e.g., North and then append to North 22.
Back to top
View user's profile Send private message
dacm
Super User
Super User


Joined: 07 Jan 2010
Posts: 769

PostPosted: Thu Mar 29, 2012 7:15 am    Post subject: Reply with quote

'List entries' do grow within a Combo Box list during a Form session if the user modifies individual record inputs, but those 'new' entries are not persistent after closing and re-opening the Form (not necessarily in edit mode). The 'new' entries are added to the bottom of the list, so they shouldn't cause much of an issue. I don't know if this is a bug or a feature, but the behavior could be good or bad, acceptable or unacceptable, depending upon your application.
_________________
Soli Deo gloria
Tutorial: avoiding data loss with Base + Splitting 'Embedded databases'
Back to top
View user's profile Send private message
cowboy1611
General User
General User


Joined: 01 Nov 2011
Posts: 21

PostPosted: Thu Mar 29, 2012 8:02 am    Post subject: Reply with quote

Hello,

I wasn't going to use the Combo box, (per my earlier posts) but rather a List Box.
So there wouldn't be anything added to the list.

The issue now is that once I select an item from the list box I can't add to (append) it.
Back to top
View user's profile Send private message
dacm
Super User
Super User


Joined: 07 Jan 2010
Posts: 769

PostPosted: Thu Mar 29, 2012 8:48 am    Post subject: Reply with quote

cowboy1611 wrote:
...I want to append an entry after it's slelected from the listbox

You have a very acute requirement for a fixed list that allows input modification, but without adding to the list -- even non-persistently and discretely to the bottom of the list and limited to the Form session. That requirement doesn't fit perfectly into Base List Box or Combo Box paradigms, despite their amazing flexibilities overall. List Boxes don't allow run-time modification of the input field -- while Combo Boxes do allow run-time mods, but those mods are added to the Valuelist non-persitently for the duration of the Form session.

So perhaps you could use a List Box with Valuelist (and associated 'List entries' ...not 'List content'), then add a Single-line Text Box next to the List Box, with both assigned to the same Data field, and make any modifications to the selected and saved List Box input within the Text Box.
_________________
Soli Deo gloria
Tutorial: avoiding data loss with Base + Splitting 'Embedded databases'
Back to top
View user's profile Send private message
cowboy1611
General User
General User


Joined: 01 Nov 2011
Posts: 21

PostPosted: Thu Mar 29, 2012 10:13 am    Post subject: Reply with quote

dacm

Thanks for the feedback. So basically what I'm thinking of isn't really doable,
that's OK I'll work around it, at least now I won't spin my wheels trying.


p.s. I'm new to DB, and have limited needs for it.
In simple terms (non programing, source code etc) I'm thinking, one of the purposes of a list box is ease of use i.e. saves typing, and/or typos from typing..... so you have this list and
you select from it, now you have your choice, which is what you would have put in if you had entered it manually, but now you also want to append it..... sounds doable
but I guess not.

I'm trying to think as I'm typing, if there are other programs that we use or even internet stuff where this type of thing occurs, I think it must somewhere, and if so why not in DB....
Oh well
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group