Cant present input values OptimizationResult

Hi,

when i use the OptimiseButton in viktor, I am able to present all optimisation result values. But the input values are not presented if I follow the docs.

the code I use:

    test_page = Page('TEST')
    test_page.new_section = Section('TEST_SECTIE')
    test_page.new_section.input_field_1 = NumberField('input 1')
    test_page.new_section.optimize_button = OptimiseButton('Optimaliatieknop',
                                                           method='test_optimisation_function')
    def test_optimisation_function(self, params, **kwargs):
        results = []
        for i in range(0, 10):
            params = {'test_page': {'new_section': {'input_field_1': i}}}
            analysis = {'result': i * 2}
            results.append(OptimizationResultElement(params=params, analysis_result=analysis))
        return OptimizationResult(results=results,
                                  result_column_names_input=['input_field_1'],
                                  output_headers={'result': 'Resultaat'})

The presentation of results I get:

As you can see, the input values are not presented. I’ve tried to replace result_column_names_input=['input_field_1'] with result_column_names_input={'input_field_1': 'Invoer'} (similar to the output header) But this doesn’t work.

Hi Tom,

Since the input parameter is nested, you need to use the dotted path like this (unless you have used the name attribute):

result_column_names_input=['test_page.new_section.input_field_1']

I think we can improve the docs with an example in case of a nested parametrization.

Does this solve the issue?

It does solve the issue, thank you :smile:

And yeah, you should improve the docs, because the example is with a nested parametrization, which means the example is not correct I guess :slight_smile: