when searching a catalog, I want to change the Dropdown selection to show more fields

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Feb 9, 2016
Company: CTC

Hi,

please look at the attached picture. I have a catalog called cities. it has an owner attribute which is state\province. When the user searches the dropdown selection for a city then by default it shows the city name and its code. I want to show the state\province instead of the code. How can I do it?
for example, lets say there is a city montreal in Quebec with code CRM00002. and another city called also montreal but in Ohio and its code is CRM30918. Currently by default when searching it shows city name (code). I want it to show city name (state name)

Download city.PNG (14.85 KB)
 
#2
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Mar 10, 2017
Company: Rufinor

Hello  Mubarak Sami!

The easiest way to do this in my view is to create customized representation of the cities elements in the cities catalog manager module. After you create this presentation it will appear in all choice fields.


Code
Procedure PresentationGetProcessing(Data, Presentation, StandardProcessing)
   
   
   StandardProcessing = false;
   
   Presentation = Data.ref.description+" / "+Data.ref.state+" / "+Data.ref.province;
   
   
EndProcedure

 
#3
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Feb 9, 2016
Company: CTC

Dear Alex,

thank you for your kind support.
I tried what you suggested and unfortunately it didn't get the result that I want.
Kindly look at the attached pictures:
1. it did change the presentation of the city catalog every where. as you can see in the list column city shows city ( province ).
2. However, it does not change the drop down search.
What I want is the opposite of this, I want to change only the drop down search to become city (province). And I want to keep the presentation reference in list columns to only city.

 
#4
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Mar 10, 2017
Company: Rufinor

It seems to me that your dropdown menu is compiled as a choice list programatically and attached to the dropped down menu. If you just use pure quick choice option it should work in the way I mentioned earlier.

 
#5
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Feb 9, 2016
Company: CTC

Thanks Alex for the follow up.
would you please explain what you meant by use pure quick choice option.

 
#6
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Feb 9, 2016
Company: CTC

while looking at the other properties of the catalog, I found this as in the shown picture. It seems there is a way to set the fields that show up in the drop down list. However, only Description and Code fields can be used. How can I put Owner instead of Code?

 
#7
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Feb 9, 2016
Company: CTC

by the way, I tried to remove the code field from the presentation of drop down as shown in the attached pictures but unfortunately still showing in the drop down list

 
#8
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Oct 4, 2018
Company:

Hello, Mubarak!
If you don't need code, you can remove it just set its lenght to 0.

Edited: Sergey Simonenkov - Jul 29, 2019 09:21 AM
 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.