Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

Display 'select' values in Browse Form

Questions related to using nuBuilder Forte.
Post Reply
Marvo
Posts: 12
Joined: Mon Nov 15, 2021 11:11 pm

Display 'select' values in Browse Form

Unread post by Marvo »

Hi

I have a select field, with the options created in list, e.g. 0|Male|1|Female
This works fine in the Edit form

On the Browse form though, the values are shown as 0 or 1 rather than showing Male or Female

How to display the Male/Female on the browse screen and not the list 'index #'

Thanks
klasyc
Posts: 5
Joined: Thu Nov 11, 2021 4:25 pm

Re: Display 'select' values in Browse Form

Unread post by klasyc »

Hi Marvo,

open the form properties, select the Browse tab and wrap your gender column name by the IF SQL statement (https://www.w3resource.com/mysql/contro ... nction.php):

Code: Select all

IF(gender = 0, "Male", "Female")
The next possibility would be probably the custom PHP code in Before Browse action.

Hope this helps :)
Marvo
Posts: 12
Joined: Mon Nov 15, 2021 11:11 pm

Re: Display 'select' values in Browse Form

Unread post by Marvo »

Thank you! That worked! However, I have other select fields that 5 or 6 options in the list. I can't use IF this. .... else this...

Is there a similar SQL statement that checks multiple values
if it's 1 then this, if it's 2 then this, if it's 3 then this, if it's 4 then this .........

Thank you!
kev1n
nuBuilder Team
Posts: 4566
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 529 times
Contact:

Re: Display 'select' values in Browse Form

Unread post by kev1n »

Either replace the list with an SQL that pulls the values from a table and then use a join in the browse to retrieve the description for the values or use multiple replace() like

Code: Select all

REPLACE(REPLACE(REPLACE(your_column, '1', 'One'),'2','Two'),'3','Three')
Marvo
Posts: 12
Joined: Mon Nov 15, 2021 11:11 pm

Re: Display 'select' values in Browse Form

Unread post by Marvo »

Thank you - sorted!
Post Reply