Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

how to make dropdown selection appear in browse or reports.

Questions related to using nuBuilder Forte.
Post Reply
benritter
Posts: 49
Joined: Wed Aug 26, 2020 10:38 pm

how to make dropdown selection appear in browse or reports.

Unread post by benritter »

Hello, I have several dropdown/multiselect objects in my project. In all of the reports or browse forms I have made, the value from the select objects displays as their "option" number. For example, One of my dropdown objects has a list of cities. The user selects their city when they enter and save their information. When I access that field in a browse form or report, instead of seeing the name of the city, I see the related number that is stored in the database. Can I change the setting to display the words instead?
Thanks!
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: how to make dropdown selection appear in browse or repor

Unread post by Janusz »

Hi,
For select you define a pair composed of ID and Displayed Value.
If you want them to be the same - define the same value for both - you can define in Select/Sql for example:

Code: Select all

a1|a1|b2|b2|c1|c1
or with myql

Code: Select all

SELECT
    ofs_description, ofs_description
FROM
    Oferta_status
If you like nuBuilder, please leave a review on SourceForge
benritter
Posts: 49
Joined: Wed Aug 26, 2020 10:38 pm

Re: how to make dropdown selection appear in browse or repor

Unread post by benritter »

Thanks Janusz,
That works. I had all the pairs defined as 0|thing1|1|thing2|2|thing3 etc. because I thought the numbers were necessary for the code to execute properly.
Having the pairs matched makes me wonder, why does it need a "pair" at all? and not simply a list. In other words, why does it need a separate "option id" and "display id"?
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: how to make dropdown selection appear in browse or repor

Unread post by Janusz »

normally it gives better flexibility you can use (short ID) and more descriptive label - and probably due to that it was done like that
from practical point of view if I use the same select in different forms I create small sql table with phpmyadmin and in the select I use for example:

Code: Select all

SELECT
    ofe_descr, ofe_descr
FROM
    Oferta
because in case of any changes or extention you change it just in one place only.

If you prefer to store ID and make much more descriptive label you can use something like that in select (just one example from my application):

Code: Select all

SELECT * FROM
(SELECT raports_id,
CONCAT(rap_type,REPLACE(REPLACE(rap_frozen,1,'✔ '),0,'    '),rap_number) AS raporty
FROM raports 
WHERE rap_type IS NOT null
ORDER BY rap_updated_on DESC
LIMIT 200) 
AS tab3
ORDER BY raporty ASC
If you like nuBuilder, please leave a review on SourceForge
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: how to make dropdown selection appear in browse or repor

Unread post by Janusz »

and to add - in Browse/Display form definition you can use as well any sql statement like for example:

Code: Select all

REPLACE(REPLACE(REPLACE(rej_appr,1,'✔'),2,'❌'),0,'')
to make your browse form more readable or to better display some data
If you like nuBuilder, please leave a review on SourceForge
Post Reply