Code not working as expected

thanks Mark & Calvin.

going to look at this again tomorrow. this should be simple, at least logically. the syntax seems to be killing me / us…

for eh most part, this works. and has worked fine up until now.

it works as I want (mostly) if I leave off the ‘else’ part. it’s this ‘else’ that seems to be the bug… to spit out table data if a condition is met, or to force the variable to “XXX” if that condition is not met…

So, I’ll be looking at how to write this all with 'if -then ‘else’ as opposed to having the switch function in the middle…

I was initially wondering if you can put a ‘switch’ in the middle of an ‘if-else’ function…

Hi Mark,
I’m back at doing another congfigurator, and have some time to try & learn a bit more.

But am getting frustrated with some simple tasks:

You mention an “enable” property. I can’t find this in the expression drop-downs… can you be a little more exact in what I should be looking for / using?

What I am trying to do, i feel is super simple. Have a check box turn on or off the ability to enter text in a character box.

if the check box = true (checked)
then text box is null; no user entry allowed.

I have:
Inputs.CH_CustCode.Value = “”;

in the check box ‘On Field Change’, so that it erases whatever was in the box initially, but I just can’t find the 'make the text box ‘read only’ variable / value.

I’ve tried an if / else statement, but that doesn’t’ seem to work either. Or, I have the wrong ‘bit’ in the code…

There is a ReadOnlyExpression property for controls. Set the code in that expression to return true when your checkbox is false. Like:

For example, I can make the Rope Length field be read only when the Rope Option is unchcked.



I can make the text box go invisible, I just can’t make it greyed out…

cool, OK, let me try that!!

OK, thanks!

yes I see what it does (but would never have thought to “write” it that way!)

As stated a few times, i know what I want to do, but don’t know the syntax or way to write it!

I find experimentation to be the best teacher.

thanks again!

I fully agree, but when it’s something trivial (such as a missing ; or know the difference between = and ==) just makes it that much more frustrating!

and not knowing how to decipher the error message…

1 Like

I am having a similar problem. I need users to be able to change a choice they’ve made. As things stand, you have to close out the Cinfig, and start again. Our EPICOR guy gave me this code:

The problem is that when I drop it in, each line bombs out because of the “ReadOnly”. So of course I went to the Inputs to see what my choices were![image|643x500]
…and nothing here would give the the desire result.(upload://mqNAIwoFsOHCUE973rHI8bythwT.png)
I went a step farther and dropped it into Visual Studio, and got this:

…same result! How do I accomplish allowing users to change a selection once they’ve made it, and have the remaining inputs refresh accordingly?

That code you were given should be in a Configurator Expression from inside the Configurator Designer.


Not in a customization.


if that is the Configuration Expression window, then there shouldn’t be the using ... line

Let me back up a second … the ReadOnly property expects an expression. So you wouldn’t assign it a value like true or false, but rather an expression that returns true or false.


You can’t assign the ReadOnly property outside of the control itself.

You need to select the control, then bring up the expression editor for the ReadOnly Property


Then enter your logic for when that control needs to be read only or not.

You my good Sir, are a rockstar!!! Thanks a Million!!! I’ll give that a whirl, and report back.

Consider it a function that must return either true or false.

so your code would be

return false;

if you needed the ReadOnly aspect to depend on something else, like if cmbPaintColor was RED, then your code would be

if(Inputs.cmbPaintColor.Value == "RED"){
    return true;
    return false;

You are the Champ! Thank you, works like a charm!!!

Another question, I need the remaining inputs to refresh after the change is made to an input, so do I add my “refresh” to each “readOnly” expression as well?

I’ll jump in here just to get some more points for being active. You can absolutely set the other inputs to refresh with the following code.


My advice to you thought would be not to put it in the read only section as that section of code is ran anytime a change is made anywhere in the configurator. I would recommend putting it in the ‘On Field Changed’ section of code. I would also rccomend trying to be more specific with the inputs that are getting refreshed to try and reduce any unnecessary code from running and slowing down the configurator.

An example of how to select specific inputs to refresh is the following:


I already have the in the OnField for each input, my goal WAS to make it refresh each time a change is made. This is a Config to build trucks. If a sales person accidentally selects the wrong CA(Cab to Axle length) when they go to correct it, I need everything after it to refresh or the remaining choices won’t apply.

Inside of the yellow box is the main “keys”, I have the first 5 inputs Concant’ed into Key1, but I needed the ReadOnly Expression on everything down to the “Brand”.

What I am suggesting then is to put it in the field change for the CA field to refresh the other fields


This lets you control the fields that are getting updated so that if the change to CA doesn’t affect some fields they don’t get updated.

If it is in the read only then even when they are selecting something like Fire Extinguisher it will go and try to refresh all the dynamic lists.

Using a car/trunk type example if you have three combo boxes of Make, Model, and Engine size, when you select the model you would want the engine size combo box refreshed but not the Make. Refreshing the make would just be code that has (small) potential to cause issues because you don’t want the configurator to take forever to run and you don’t want it to refresh selections that don’t need it.