How to access params without using decorator


Is there any way to access params without using decorator.
In my case, I want to access params inisde of initialization function.(line 85)

Please guide on this. Thank you.

Hi Darshan,

Thank you for your question. The VIKTOR platform architecture is set up in such a way that assumes that the params is retrieved at the start of an end point. An end point in the Controller is either:

  • A view (this is as you may have noticed the methods defined with a decorator for a given view)
  • A method of a button (this method, defined within the controller, is referenced on the button that is defined in the Parametrization)

Params are also available when defining callback functions, or by retrieving them through the API.

But, to get back to your specific case, it seems that you want to initialize objects, that you (I assume?) want to use in other calculations subsequently? Unfortunately, this is not possible in the way you would like to. The reason for this is because the platform is set up to be stateless. More information on this can be found here:

If you would like to initialize objects, one would need to redo the initialization at the start of the calculation, whether it is a view, or button.

There are ways, however, to create stateful code. This can be achieved by making use of Storage. You can save results that can be used in subsequent calculations.

I hope this was helpful? If not, could you elaborate what you would like to achieve?

1 Like

Hello Marcel.

You guessed it right, that I want to initialize objects and want to use it later.
This was helpful, thank you for all your explanation.
I think for a moment, I will try to workaround and if I get stuck, I will get back to you.
Thank you for your help.


1 Like