Source language: Translate to:

Show results in combo box

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Show results in combo box

Postby HackinHoodLogicsTm » Sun Oct 18, 2015 9:35 am

Hello Neobookers can someone help me on this. I have a database with table with the following fields "Firstname" and "LastName"

I have created a combo box and wants it to display the records in the two fields Firstname and lastname all in one line in the combo box like
[firstname] [lastname]
Say John Dough

But when I try my best its not working. Pls can anyone help me on this
I am proud to be a Neobooker!!!
www.neosoftware.com
Special Thanks To
Mr. David Riley
User avatar
HackinHoodLogicsTm
 
Posts: 120
Joined: Wed Aug 28, 2013 7:03 am
Location: Ghana

Re: Show results in combo box

Postby Gaev » Sun Oct 18, 2015 10:05 am

HackinHoodLogicsTm:

But when I try my best its not working.

Why don't you post what you tried ? ... and tell us how the result differs from expectation.
User avatar
Gaev
 
Posts: 3735
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Show results in combo box

Postby HackinHoodLogicsTm » Sun Oct 18, 2015 10:55 am

I created a combo box and assigned a
[ firstname ] [ lastname ]

Into the list itmm
And then created a button and assigned this code on buttonClick

dpbFileToVar "Database" "Table" "First Name" " [ firstname ] " and the delimiters

Then copied the same code below but this time I placed the last name field in the variable " [ lastname ] "

But the combo box displays the first name on the first line and last name on the second line which is not what I want

I want the two name to display on the first line like
John Dough

Not
John
Dough

Hope u understand now
I am proud to be a Neobooker!!!
www.neosoftware.com
Special Thanks To
Mr. David Riley
User avatar
HackinHoodLogicsTm
 
Posts: 120
Joined: Wed Aug 28, 2013 7:03 am
Location: Ghana

Re: Show results in combo box

Postby Gaev » Sun Oct 18, 2015 1:10 pm

You can only specify one field in the dbpFieldToVar command ... so you can ...

1) either create another field in your Database Table (say FullName) ... which you auto-populate (from FirstName and LastName) every time a record is added or updated ... then use ...
Code: Select all
dbpFieldToVar "yourDatabase" "yourTable" "FullName" "[FullNames]" "Delimiter=[#13]"

... where [FullNames] is the variable to contain the values of your ComboBox.

2) or you can dynamically create this list by Looping through every record ...
Code: Select all
... place any dbpQuery command here if you don't want to include every record

... get record count
SetVar "[LoopCount]" "[yourDatabase.yourTable.$RecCount]"

... position at first record
dbpFirst "yourDatabase" "yourTable"

... loop through all records
SetVar "[FullNames" ""
Loop "1" "[LoopCount]" "[thisIteration]"
   ... construct and add list entry
   SetVar "[FullNames]" "[FullNames][#13][FirstName] [LastName]"
   ... advance to next record
   dbpNext "yourDatabase" "yourTable"
EndLoop
... remove very first [#13]
StrLen "[FullNames]" "[FullNamesLength]"
SubStr "[FullNames]" "2" "[FullNameslength]-1" "[FullNames]"
User avatar
Gaev
 
Posts: 3735
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Show results in combo box

Postby HackinHoodLogicsTm » Sun Oct 18, 2015 3:47 pm

Thanks Bro. It really helped. U te genius
I am proud to be a Neobooker!!!
www.neosoftware.com
Special Thanks To
Mr. David Riley
User avatar
HackinHoodLogicsTm
 
Posts: 120
Joined: Wed Aug 28, 2013 7:03 am
Location: Ghana

Re: Show results in combo box

Postby stu » Mon Oct 19, 2015 3:43 am

You could also create a view on your database and concatenate the two columns...
User avatar
stu
 
Posts: 320
Joined: Wed Aug 07, 2013 11:37 am


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 1 guest