Sorting data in Foreign key drop down lightswitch

自古美人都是妖i 提交于 2020-01-15 17:52:00

问题


I having country as Foreign key in one of the table.

So it is shown as drop down(is it a drop down? see image above)

My question is how can I specify the data in the drop down/input is to be in sorted order?


回答1:


As Crezzer mentioned, the foreign key drop down details pickers are intrinsically sorted by entry order (with the earliest records appearing at the top).

However, if you'd like to change this sort order, you simply need to add a sorted query against your countries table. This can be done by either clicking the 'Query' button at the top of the table designer screen or by right mouse clicking on the Countries table in the 'Solution Explorer' and choosing the 'Add Query' option.

You can then add a query along the following lines (specifying the desired sort by fields):

Then, on the screen featuring the countries drop down details picker, you would select the 'Add Data Item...' button (at the top of the screen designer) and introduce the sorted query onto the screen as follows:

You can then select to use this sorted query for the drop down details picker by highlighting the control in the screen designer and changing the 'Choices' property from 'Auto' to the added query as follows (the required property selection is highlighted in purple):



来源:https://stackoverflow.com/questions/33819393/sorting-data-in-foreign-key-drop-down-lightswitch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!