JTG - 2020-01-07

This is a bug report of sorts, as well as a way for me to leave a note for others who may encounter this issue.

Calling a method in a CFC is pretty straightforward when that method belongs to another function block, but it doesn't work very well when the method belongs

If the internal method has input variables, the compiler will give a C0040 error "Function 'MethodName' requires exactly '#' inputs", even when the input pins are all visible and connected.

I've found 2 workarounds,

  1. Don't use inputs, just call local variables directly from the method. This gets clunky really fast so isn't a great solution if you need inputs. Also, the method's box will just be floating in the CFC with no visible connections, which kinda defeats the purpose of CFC

  2. Give the method a return type or an output. For whatever reason, this avoids the compile error. You never have to write to the output or use it in the CFC, but if you hide the output pin the error will return so you have to just leave it dangling or connect it to something

Hopefully these workarounds won't always be necessary in the future

IMG: Bild