I have noticed that when I programmatically set a value of an input, the On Field Changed method does not execute. Can I also manually execute that On Field Changed method when setting the value of that input? Or is there a better way to achieve what I’m trying to do? My alternative right now is to always copy the contents from that On Field Changed code into my code block where I am setting the value of the input.
I have not revisited this in the Kinetic Configurator but I feel your pain as I have dealt with this extensively from Classic. I too would just put in the code I needed to have run upon that field change into the code that set the field in the first place.
Right now I believe most of that code that would fire on the change is actually broken up and stored as UD Methods in the configurators, then instead of having the code live in the on change blob I just call that UD Method, same thing when I need to string things together, it just calls the appropriate UD Method(s).
I never really tried to find a way to programmatically fire the OnFieldChanged expression of a different input. I wonder if there’s an Inputs.InputName.OnFieldChanged()
method you can fire… Gonna have to look in to that.
This is what I do to get around it. Create a client-side UDMethod like UpdateDimensions
and then add that in OnFieldChanged of any fields that would affect the dimensions.
Yep - I have used the UDMethods to simplify things… but I was hoping to do something like @kve proposed with Inputs.inputName.OnFieldChanged(). That’s actually what I had envisioned might be a thing but I lack the knowledge of how to check to see what methods might be available for use. The “intellisense” does not show much beyond the handful of typical properties you might want to set.
One thing that might help steer someone who knows how to look into this… if you open up the XML of the configurator, you can find the xml object that stores this info… so it does exist somewhere if it could be accessed.
this is what it looks like in the XML
<PcInputsExpr>
<Company>VANAIR</Company>
<PartNum />
<RevisionNum />
<InputName>chkCompressor</InputName>
<ConfigID>CONFIG-EPEQ</ConfigID>
<TypeCode>Changed</TypeCode>
<SeqNum>1</SeqNum>
<Expression>if (Inputs.chkCompressor.Value == false)
{
Inputs.cmbCompressorICFM.Value = "None";
Inputs.cmbAirTank.Value = "None";
Inputs.cmbAirExtCable.Value = "None";
Inputs.cmbAirExtHarness.Value = "None";
Inputs.cmbAirHose.Value = "None";
Inputs.chkSimultCompressor.Value = true;
UDMethods.UpdateInputsAndValues(Inputs.cmbCompressorICFM.Label, Inputs.cmbCompressorICFM.Value);
UDMethods.UpdateInputsAndValues(Inputs.cmbAirTank.Label, Inputs.cmbAirTank.Value);
UDMethods.UpdateInputsAndValues(Inputs.cmbAirExtCable.Label, Inputs.cmbAirExtCable.Value);
UDMethods.UpdateInputsAndValues(Inputs.cmbAirExtHarness.Label, Inputs.cmbAirExtHarness.Value);
UDMethods.UpdateInputsAndValues(Inputs.cmbAirHose.Label, Inputs.cmbAirHose.Value);
UDMethods.RV_ICFM();
UDMethods.RV_AirStorage();
UDMethods.RV_AirExtCable();
UDMethods.RV_AirHose();
}</Expression>
<SysRevID>24661909259</SysRevID>
<SysRowID>012f9244-2ef7-4466-aa1a-7549d8a5eb0e</SysRowID>
</PcInputsExpr>
Under PcInputs it’s the <OnLeave2>
property, if that helps. Normally I’d be trying to find it in a configurator by now, but I’m about to be back in an implementation meeting.