How to get a combo box to trigger another combo box?

HI,

OK, am new to programming, so the syntax eludes me.

I have one combo box, that sets a part number string based off a look up table (those I can do!) But I want to be able to have a check box that ether allows this, or allows for a manual part entry, and override the part number string.

it shouldn’t be hard to do.

the two combo boxes should have a line of code that says:
if check box = true, then PCLookup “table”, “value”…
else variables = user input string;

How do I get the combo box to act if the check box is true / false

You can disable a control based on a value of another control. You can set the Checkbox and then use the Disable formula property to enable or disable the ComboBox or the Text box (for the part number) based on the value of the checkbox.

Will that work?

Later, you’ll want logic that selects the combo box value or the text box value for your part based on the value of your checkbox.

You can try using dataview information before dropdown, or you can use special filtering syntax in the properties window of dropdowns, but I don’t remember it. I think that’s Epicor documented somewhere

private void epiComboC2_BeforeDropDown(object sender, System.ComponentModel.CancelEventArgs args)
                {
                                // ** Place Event Handling Code Here **
                                                                EpiDataView edv = oTrans.Factory("Contact");
                                                                
                                                                epiComboC2.Rows.ColumnFilters["CodeID"].FilterConditions.Clear();
                                                                epiComboC2.Rows.ColumnFilters["CodeID"].FilterConditions.Add(Infragistics.Win.UltraWinGrid.FilterComparisionOperator.StartsWith,edv.dataView[edv.Row]["ShortChar03"]);
                                                                
                }
1 Like

Uhm, sure?!

Yeah, I get that I can control things, and in this case one will control the other, and either allow for a user input or read it off a table.

If check mark = false, then read off the table
if check mark =true, then allow user to input a string, and substitute that string in place of string from table.

I just don’t know how to write that in C#… or what I’m missing in the expression…

return Inputs.CH_Override.Value = true;
doesn’t seem to work, I seem to be missing something…

Dropdowns can be dynamic, with multiple sources. And you setup rules for which source to use. That checkbox could be use in the selection of which “source”

Most of coding in Configurator isn’t about being a c# syntax wizard, it’s about knowing where to put your code. Also, there are always many, many different ways of doing the same thing.

What Mark said seems like your easiest option; I’ve done similar things several times. Put code on the “On Field Changed” action of the checkbox to set the visible or enable/disable property of your ComboBox and TextBox appropriately. Always make sure to code for all user scenarios (checking and unchecking the box in this case). People, myself included, often think the user will follow a linear path through their Configurators and they forget to code for when users change their mind on an input or go back a page, etc.

3 Likes

Hi Paul,

You would need to add a textbox to manually enter the part num, and then toggle the read only via the checkbox. Ideally, if the user selects a value via the combobox you would then auto-populate the textbox with the value, that way you
can just pass the textbox to record creation as the input string, or the method rule if the part num is job mtl.

OK, this is what I’m missing then:

I have:
a check box: CB_Override
A character box: CH_Jet
A character box: CH_Jet_Override

I want the character box CH_Jet to either accept the entry in CH_Jet_Override or set it to 4

I have the following code in ‘on field validate’ of CH_Jet:

if (Inputs.CB_override = true)
{
Inputs.CH_Jet.Value = Inputs.Ch_Jet_Override.Value;
}
Else {Inputs.CH_Jet.Value = (“4”)};

the syntax says I have 2 errors, both missing a ; … where do these go? what am I missing?

I don’t have Configurator access now but go to your Configurator Designer screen, click on your CB_Override field and post a screen shot being sure to include the properties panel on the right-hand side.

if (Inputs.CB_override.Value == true)
{
	Inputs.CH_Jet.Value = Inputs.Ch_Jet_Override.Value;
}
else 
{
	Inputs.CH_Jet.Value = "4";
}

OK, managed to get the If/then statement to run:

if (Inputs.CB_override.Value = true)
{
Inputs.CH_Jet.Value = Inputs.CB_Jet_Override.Value;
}
else
{
Inputs.CH_Jet.Value = “4”;
}

this is in the ‘On Field changed’ action (I tried in it the ‘On field validating’ , and it crashes Epicor!)

now, while it does allow me to enter the string from CB_Override.Value, it will only grab it when I hit the check box. But the check box doesn’t turn on or off, it only seems to dump the value of CB_Override into CH_Jet.

I feel I ether am missing something to revert back, or the if/then statement is missing something to continuously check if CB_Override is true or false… I kinda feel there needs to be a ‘page refresh’ in the on field validating of both the CB_Override & CB_Jet_Override. But am baffled how ask for this…

I get the following error with this line of coding:

The following errors were found during compile:

CS1061 - c:\Users\pshepherdson\AppData\Local\Temp\7\ConfigDump\Client_paul_testInputEventCollection.cs (60,31) - ‘Erp.UI.Cfg.TEST92e046bb88a74b178287d9e42914de43._paul_testInputControlCollection’ does not contain a definition for ‘Ch_Jet_Override’ and no extension method ‘Ch_Jet_Override’ accepting a first argument of type ‘Erp.UI.Cfg.TEST92e046bb88a74b178287d9e42914de43._paul_testInputControlCollection’ could be found (are you missing a using directive or an assembly reference?)
Total number of Errors: 1, Warnings 0

change to
Inputs.CH_Jet_Override.Value;

if (Inputs.CB_override.Value == true)
{
Inputs.CH_Jet.Value = Inputs.CH_Jet_Override.Value;
}
else
{
Inputs.CH_Jet.Value = (“4”);
}

still getting:

The following errors were found during compile:

CS1061 - c:\Users\pshepherdson\AppData\Local\Temp\7\ConfigDump\Client_paul_testInputEventCollection.cs (60,31) - ‘Erp.UI.Cfg.TEST8d38ba89d1ee4d4582cea2c8cf039f14._paul_testInputControlCollection’ does not contain a definition for ‘CH_Jet_Override’ and no extension method ‘CH_Jet_Override’ accepting a first argument of type ‘Erp.UI.Cfg.TEST8d38ba89d1ee4d4582cea2c8cf039f14._paul_testInputControlCollection’ could be found (are you missing a using directive or an assembly reference?)
Total number of Errors: 1, Warnings 0

Did you select your Input names from the list vs. typing?

I initially typed them in.

But i do use the list at the top “Available selections” to populate it.

I find it difficult as one screen allows you to type anything, while the expression builder seems to be missing steps & functions… so, I’m kinda bouncing between them… trying to figure out how to write an expression in one, and get the same results in the other…

if (Inputs.CB_override.Value == true)
{
Inputs.CH_Jet.Value = Inputs.CB_Jet_Override.Value;
}
else
{
Inputs.CH_Jet.Value = (“4”);
}

OK, now I’m, not getting any error rmessage… weird.

So as you have seen/heard, Configurator logic is event-based. So you need to think about the state of the controls as the user clicks around the screen. In order to control the first pass through a configurator, I’ll set all the inputs except the first to Read-Only. This allows me to alter the controls as inputs are filled. You still have to be careful to reset fields if dependent inputs are changed. In this case, you Read-Only expression for the CB_Jet_Override is !BC_override (not the value of the override input). So when the user makes override True, the Read-Only expression is false and a user can fill the field. You can even hide the field in the On Field Change event.

So start thinking of events and not linear programming. If you’re using an expression multiple times, put it into a User Define Method and call it in the expression.

Hope this hints get you going. It’s a bit of a curve but after a bit, you’ll get it.

Mark W.

Thanks Mark,

the ‘resetting of fields’ still eludes me, as in how to get them to reset…

Yeah, forgot about the 'read only expression. will need to read up on that one…

this seems to do the trick:

CO_GasType:

List Items:
NAT Natural Gas
PRO Propane Gas 100%

On Field Validating:
{
switch (Inputs.CO_GasType.Value)
{
case “NAT”: Inputs.CH_JetInstalled.Value = Inputs.CH_NatJet.Value; break;
case “PRO”: Inputs.CH_JetInstalled.Value = Inputs.CH_ProJet.Value; break;
};
Inputs.CO_Elevation.Value = “”;
Inputs.CH_JetInstalledPN.Value = PCLookUp.DataLookup(“GAS_JET_PART_NUMBER”, “Hardt Part Number”, Inputs.CH_JetInstalled.Value);
Inputs.CH_JetSpare.Value = “”;
Inputs.CH_JetSparePN.Value = “”;

CO_Elevation:

List Items:
1000 0 - 1999 feet above sea level
2000 2000 - 2999 feet above sea level
3000 3000 - 3999 feet above sea level
4000 4000 - 4999 feet above sea level
5000 5000 - 5999 feet above sea level
6000 6000 - 6999 feet above sea level
7000 7000 - 7999 feet above sea level
8000 8000 - 8999 feet above sea level
9000 9000 - 9999 feet above sea level
10000 10000 - 10999 feet above sea level

On field validating:
Inputs.CH_JetSpare.Value = PCLookUp.DataLookup(“GAS_JET_HIGH_ALTITUDE”, Inputs.CO_Elevation.Value, Inputs.CH_JetInstalled.Value);
Inputs.CH_JetSparePN.Value = PCLookUp.DataLookup(“GAS_JET_PART_NUMBER”, “Hardt Part Number”, Inputs.CH_JetSpare.Value);
switch (Inputs.CO_Elevation.Value)
{
case “1000”: Inputs.CH_JetSpare.Value = “Not Required”; Inputs.CH_JetSparePN.Value = “Not Required”; break;
};

CB_Override

On Field Changed:
if (Inputs.CB_Override.Value == true)
{
Inputs.CH_JetInstalled.Value = Inputs.CH_Override_Jet_Install.Value;
Inputs.CH_JetSpare.Value = Inputs.CH_Override_Jet_Spare.Value;
Inputs.CH_Override_Jet_Install.Invisible = false;
Inputs.CH_Override_Jet_Spare.Invisible = false;
}
else
{
Inputs.CH_Override_Jet_Install.Invisible = true;
Inputs.CH_Override_Jet_Spare.Invisible = true;
Inputs.CO_Elevation.Value = “”;
Inputs.CO_GasType.Value = “”;

But sadly, while I seemed to have solved this, a new problem has arisen… :frowning: completely unrelated…

As with any solution, start simple and build in small steps so you know where things break. You got this.