Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL (Archived)

Combo box - add values dynamically to drop down list?

Posted on by Microsoft Employee

Hello:

I have a very basic question on adding combo box as customization with the environment Dynamics SL 2011FP1. The question is - can we add the drop down list values dynamically?

1. Add a combobox, bound to table A.field_a

2. To the combobox drop down list, set values obtained by "Select field_b from B where field_c = 'XX' "

I am sure that this is not the first time asked, any links or feedback will be very much appreciated!

*This post is locked for comments

  • Arnas Profile Picture
    Arnas 10 on at
    RE: Combo box - add values dynamically to drop down list?

    I know it is old question, but never fully answered.

    I managed to add custom combo-box and add value list based on query.

    All if working fine accept value in data grid view is somehow not visible/partially visible( in yellow)

    In form view all is OK

    pastedimage1568143509710v1.png

    I would really appreciate some answer.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Combo box - add values dynamically to drop down list?

    Thanks for the insight.

    I could not locate the actual screen that is dynamically setting the value from PJCODE table to its combo box list (checked some screens in Project Control) but it is helpful information that there are some usage of dynamic list in existing screens. Thanks again.

  • Verified answer
    Erich Strelow F Profile Picture
    Erich Strelow F 1,642 on at
    RE: Combo box - add values dynamically to drop down list?

    As someone with an IT background, I like the PV-lookup approach because it's manageable.

    But in the real world there are such things as in-betweens.

    If you have the Project related modules, you may research the so called Code File. The Code File is really a SQL table called PJCODE. I don't have any real insight on this. It's indeed an extensible collection of lists for the user to choose from in several screens. And yes, they are combo box based. So, in the end, combo box aren't just for static lists.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Combo box - add values dynamically to drop down list?

    Hello Erich,

    Thanks for the quick reply, I appreciate it. I agree that PV-look up would be more straightforward for this type of implementation - I wondered if combo box could be a choice too.

    setprop("xCooking", PROP_CUSTLIST, "R;Rare,M;Medium;W,Well")

    Supposedly, the string "R;Rare,M;Medium,W;Well" will have to be dynamically created in the scenario that selection values are obtained by query result, which might not be worth spending time, under the circumstance SL provides PV-look up feature.

    Please add any comment if you have any - otherwise, I would conclude that SL Combo Box feature would be more suitable for setting static values to the selection list.

    Thanks!

  • Erich Strelow F Profile Picture
    Erich Strelow F 1,642 on at
    RE: Combo box - add values dynamically to drop down list?

    The SL most natural approach to this is the PV List. PV stands for "Possible Values". Browse the forum for it, you will find valuable information. Is not very well documented in the product, though. The https://community.dynamics.com/sl/f/35/t/79886 it's like the HOWTO.

    Some highlights:

    1. With PV, you can link a screen input element to a drill down list based on a SQL query.
    2. It works with text inputs, not combo box.
    3. The query is used both as a lookup feature and for data validation.
    4. The metadata for this is stored in the SYS.PVRec. SL can add/replace entries using the "Possible Values Import" screen. There should be a factory-default import file located in the DB/csvs folder.
    5. Your PVRec should look like "skclist","","","select * from B where field_c='XX'","S.K.C. Selection","B.field_b;B Field;0;0"
    6. The fields in the PV Rec are the following:
      1. An id you can refer your PV entry as: skclist.
      2. A screen number associated with the object. Blank in this case. If the list was to choose a salesperson, you would use 0831000, the salesperson maintenance screen.
      3. A language indicator. I really don't know whether this was ever implemented or not. It's always blank.
      4. The SQL query itself. As of SL 2011, the parser for this has some tricks. The selection list is ignored. In this case: select * from B where field_c='XX'
      5. A caption for the selection list. In this case, S.K.C. Selection.
      6. The remaining fields are all field descriptors. You can have many fields, not sure if there's a limit.
    7. The PVRec can be tricky. Watch for unwanted spaces and field aliasing.
    8. SL 2015 further improves this, applying the Quick Query technology.

    You can still use combo boxes and supply the list through customization. If xCooking is your combo box, use the following:

    setprop("xCooking", PROP_CUSTLIST, "R;Rare,M;Medium;W,Well")

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans