I have a very simple Inspection Planning Config I’m setting up. It has 3 inputs:
The third input C/M Ratio, is a read only calc that takes the Carbon value and divides it by the Manganese value. I put code in the “On Field Changed” event that executes the calc. When I run the configuration for the Specification ID that uses the C/M Ratio, everything works just fine:
When I load the configuration that does not use the C/M Ratio, I get this error at loadtime: “ConfigInputEventCollection.cs (58,15) - ‘ConfigInputControlCollection’ does not contain a definition for ‘eneBNRatio’ and no extension method ‘eneBNRatio’ accepting a first argument of type”
I got curious and changed the code in my “On Field Changed” literally to the code below:
if (Inputs.eneBNRatio != null)
All it’s doing is checking to see if the input exists. Still, I get the error above. I understand that if the SpecID doesn’t have the attribute in there that it makes .Invisible = true (as it should), but by the looks of it, the control is gone entirely. Does this mean, an auto-calculated (with code) attribute cannot be done? This seems crazy to me. I want the calc to work, but only if the attribute exists for the Specification.
Is the C/M ratio an Inspection Attribute?
Hello, yup it is an attribute. One that is used on the SpecID that works, and not on the one that errors.
I think that is the issue then. The attribute needs to be on the SpecID.
The SpecID does not use the C/M Ratio attribute, but the other one does.
So SpecID “Apple”, has the attributes: Carbon, Manganese, and C/M Ratio.
SpecID “Pixel”, has the attributes: Carbon, and Mangangese.
I populate C/M Ratio using Carbon and Manganese, but only if the SpecID is Apple. Strangely, I can’t even refer to C/M Ratio in the Pixel SpecID. I understand C/M Ratio is invisible when the Pixel SpecID is loaded, but it looks like I can’t even check if the object is null. Very frustrating; fingers crossed someone has ran into this before. This might scrap using Inspection Planning Configs at all.
Did you tie the C/M Ratio field on the configuration form to reference the attribute?
It’s in there. You know… I’m starting to come to the realization I think you’re trying to get me to
Why am I storing a calculation that uses other attributes to an attribute? lol, I don’t think it needs to be an attribute… it just needs to display it. That make sense? I’m thinking out loud here.
Well, if you want to be able to report on it, it needs to be an attribute in the SpecID.
What I was trying to find out was if you are using an attribute tied to a field for a SpecID that does not have that attribute in it. Try removing the reference to C/NRatio on the one that keeps erroring and see if that fixes it.
From the looks of it, I should only create attributes for items the user keys in. The C/N Ratio is not keyed in by a user. Instead, the C/N Ratio is a calculation where one keyed-in attribute is divided by the other. So really, C/N Ratio should not be an attribute. Instead, I’m going to create a control that simply displays the C/N Ratio instead. When it comes to reporting, I’ll just display the C/N Ratio by doing the same calculation.
Cheers! Thank you for your input and help. I’ll report back if I run into a snag on this.