How to display only the choices of state value by sn-record-picker

Kent Gloriana
Tera Contributor

Hello Guys.

I want to use sn-record-picker to filter the value of state

but the display field show all the record of state and it's repeating the value.

I want only to display this 4 "Requested,  Awaiting Approval, Closed Complete, Approved "

Please see the attached screenshot.

Can anyone help me?find_real_file.png

7 REPLIES 7

Hi,

Did you find any solution on this? I'm also having the same problem. 

Jeff Chilton
Kilo Expert

I think the problem is that you are querying your primary table, and not the table of choices. Your query will return every record that contains that state, and you only want one record per state. Try something like this:

 

<sn-record-picker
    table="'sys_choice'"
    field="state"
    default-query="'name=incident^element=state^inactive=false'"
    display-field="'label'"
    search-fields="'label'"
    value-field="'value'">
</sn-record-picker>

 

This example is for the Incident table, but you should be able to adapt the idea to your custom table.

 

temp.png

 

You're right. Querying the sys_choice table works! Thank you Jeff.