Error when word is input in Excel

I am working on an app where one part of the input is a word, e.g. ‘yes’ or ‘no’. In the code I used TextField to provide the input, but this input does not seem to be accepted by the code. For the NumberField the code works perfectly. Any suggestions?
Thank you in advance!

Hi Casper,

Welkom to the VIKTOR community. I will try to help you. I have some questions to better help you.

  1. What do you mean with ‘not accepted’? Is the field turning red or is it not showing up in the params dict.
  2. could you share (part) of your parametrization and View here? So i can better help you.

greetings, Maarten

Hi,

I think it is not accepted since when I try to implement an output using this input it gives an error in generating a solution.
In the picture you see that I use textfield and in the excel a value ‘ja’ of ‘nee’ should give a specific result. This is however not the case and it seems that this value of input cannot be seen in the excel.
Schermafbeelding 2024-07-15 080913
Thank you for helping me!

Greetings, Casper

Hi @casperserneels, the image you include only shows us that you defined a TextField. This is probably not where the error is originating, could you share the code where this input is being converted to your output? Most likely that is where something is going wrong.

I think this is everything that includes converting input to output. It is taken from an excel_parser_helper.py file.


Hi! That already helps me understand a bit better what you are trying to do, but I’m afraid I don’t quite understand where this relates to the field you posted earlier? I’m probably just reading over it, but where in this code do you refer to the 'Blootstelling" field? I would expect to, somewhere in this code see you refer to params.input_20?

Oh and additionally, perhaps it would also be insightful to see the error itself

I use the SpreadsheetCalculationInput when referring to params.input_20 (see image).
image

In addition I get no error in my terminal but only when computing the output. See the second image for the error I get.


image

Hi!

Unfortunately the second image is probably unrelated, it shows the status of a connected worker, but you calculation does not rely on workers as far as i can tell now.

I do see in the first image an error that a visualisation could not be shown, that has to correlate to an error being shown in your terminal. Just to be sure: you are developing this app, running the code through viktor-cli start and seeing this error in your development workspace right?

The visualisation is calculated in a function on your controller, that function fails and thus the visualisation fails. The failing function causes an error to be shown in your terminal. If it’s any more convenient, we can also set up a teams call so that I can have a look at your code and screens while we figure this out.

A solution has been found: After a lot of testing there were some small errors in the excel file and the implementation (not everywhere exactly a one-on-one copy, e.g. differences in way of spelling output). Another thing that could have lead to the solution is the fact that the files I originally used had some cells and formulas were protected. When this was enabled and in combination with the correct way of writing the input everything worked fine.

1 Like