web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

Combo box - add values dynamically to drop down list?

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Erich Strelow F Profile Picture
    16 on at

    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")

  • Community Member Profile Picture
    on at

    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!

  • Verified answer
    Erich Strelow F Profile Picture
    16 on at

    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
    on at

    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.

  • Arnas Profile Picture
    10 on at

    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics SL (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans