I am trying to set up tabs and /or sections, I add to the parametrization class, not sure if I have to do any change in the controller class. The fact is that I am getting the error
App definition is invalid: Entity type Controller is wrongly defined: Invalid parametrization
To be noted that I am trying to append the input in the controller class to write it in a word file
Hi @Paulo_Bernardino, welcome to our forums!
The error you are seeing is telling you that the definition in your parametrization is wrong, and VIKTOR can’t draw it on the screen. It seems likely to me that something is going wrong with your code in trying to create tabs and sections.
Did you manage to find this page in our documentation, describing how to do it: Layout & styling - Tabs & sections | VIKTOR Documentation?
In short, tabs and sections are optional hierarchical layering in you parametrization. You can use them if you import them from the SDK:
from viktor.parametrization import Tab, Section
And then use them to organize your fields, e.g.:
tab_1 = Tab('Tab 1')
tab_1.section_1 = Section('Section 1')
tab_1.section_1.input_1 = TextField('This is a text field')
tab_1.section_1.input_2 = NumberField('This is a number field')
tab_1.section_2 = Section('Section 2')
tab_2 = Tab('Tab 2')
Hope that helps
Hi @Roeland Weigand, thanks for the reply.
Yes, I did check the documentation but still I am getting this error msg.
I am copying here an excerpt of the code:
section = Section("Cliente")
section.nome_cliente = TextField("Nome do Cliente")
section.data_relatorio = DateField("Data do Relatório")
section1 = Section("Dados Administrativos")
section1.nome_obra = TextField("Nome da obra")
and in the Controller class:
and so on
I just need sections, at least for the time being.
As far as I can tell from the excerpt you posted nothing should go wrong in the Parametrization. However, the fact that you are calling on a param in your Controller which is not seen in the Parametrization leads me to believe that your Parametrization is larger than is shown in the excerpt.
Thus, the issue has to lie somewhere else in your Parametrization. Could you explain/show a little more about its structure? For example, it is also not possible to start a
Tab with some “bare” params and afterwards start
Sections. So the following is a common mistake:
first_param = NumberField("param 1")
first_section = Section("section 1")
sect.second_param = NumberField("param 2")
Could it be possible that this is the problem in your case as well?