Optionfield inside table, label doesn't work

Which tool versions are you using?

SDK: v13.8.0
Platform: v2023.0.8
Python: v3.10
Isolation mode: venv

image

Hi Johan,

Could you be a little more specific?

I see from your code example that you provide both a value and a label to the entries in your OptionField. What do you see in the interface? The value or nothing?

And do you still get the correct value in your params when you select an entry?

Kind regards,

De optionfield is onderdeel van een Table

in de params komt echter de โ€œlabelโ€ te staan en niet de value
c.q. value=f"name__TAG__1", label = โ€œnameโ€

In de params komt โ€œnameโ€ terecht en niet de value.

Hi Johan,

I canโ€™t reproduce your bug currently. Could it be possible that you previously had the label and the value the other way around before, and you saved the data like that? Or that you have accidentality used the label as a default instead of the value?

To check if this is happening, you can try commenting out the defaults, and to create a new entity with โ€œcleanโ€ data.

In case that is not it, do you have a minimum example for me? I tried this but that seems to work as expected. I do have a newer version of the platform, so that could explain the difference, but I canโ€™t find anything about this in the changelog.

SDK: v13.8.0
Platform: v23.04.3
Python: v3.10

from viktor import ViktorController
from viktor.parametrization import ViktorParametrization, OptionListElement, Table, OptionField, TextField

options = [OptionListElement(value="this is a value", label="this is a label")]


class Parametrization(ViktorParametrization):
    table = Table("test")
    table.test_field = OptionField("options", options=options)


class Controller(ViktorController):
    viktor_enforce_field_constraints = True
    label = 'My Entity Type'
    parametrization = Parametrization

Hi,

No worries, at the moment I do not have much time, i fixed it using the value instead of the label. Not sure why it occured. I will give an update if i encounter a simular problem. Thanks for the reply