I would like to filter the parts list displayed in the Fitting1 combo based on the selection of Mount, and/or Size and/orType and/or Orientation. The trick is that I do not know whether the user will in fact fill out all of these criteria.
Is there a smart way of doing this?
Depends what you want to do, do you want users to select at least one (Mount, Size, Type, Orientation)? Or is none at all a valid option?
What you can do is write several dynamic lists to show based on different criteria. You can also write a PC lookup table and return values in that table based on another value. So for example if you select Mount: āLeftā and your lookup table has a Mount column for Left or Right, return all PartNumbers with a Left value. That gets more complicated if you can have multiple of your options.
As a suggestion, if you want to limit Fitting1 values based on one or more options, put those options before (top/left) the Fitting box. Humans will naturally work down and left to right on forms. If you want them to possibly fill something out first, put it first. If you want to Force them to pick one or more, make Fitting greyed out until you have the minimum amount of information necessary to populate the box.
Feel free to message me, we can trade information and do a phone call/webex to try and help more.
Thank you for this thoughtful answer, Brendan!
I have two different uses for the interface:
for the experienced user, who knows the part numbers, they will drop the combo for Fitting1, recognise the part and pick it. This will populate Mount, Type, Size, and Orientation.
for the not so experienced user, who donāt know the part numbers : they will pick at least one of Mount, Type, Size and Orientation, and this will filter the combo for Fitting 1.
I have created a dynamic list for each of these two uses. I donāt know how to tell the configurator to use one or the other. Itād be easy to use a change event to tell āplease use this or that dynamic listā. But I donāt know how to do the telling. If you know how to do that, then I should be all set. Hopefully, I make sense. I do not know how to message you.
Ideally, the behaviour would allow for some of the inputs (Mount, Type, Size, Orientation) to be null or empty gracefully, without requiring a different dynamic list for each possible combination of inputs - thatād be a lot (41!)
OK so when you open up the dynamic list editor it looks something like this:

The C# condition is where you do the telling. if you just put
return true;
in there it will always just use that list. if you make two and want to base it off something, say another input value (like a checkbox being true/false) you would write:
if(Inputs.Checkbox1.Value == true) { return true;}
else {return false;}
then in the other
if(Inputs.Checkbox1.Value != true) {return true;}
else {return false;}
I think you see the challenge of using multiple determining values. I would suggest the first list that has everything and assumes all blank conditions look like:
if(Inputs.Mount.Value == āā || Inputs.Size.Value == āā || ā¦) {return true;} ā¦
assuming all values are strings. For everything else you would have to map out your OR statements, āif Mount is Left OR Size >= 55 then use List 2ā etc⦠But that gets complicated fast. What if Mount is Right but Size > 55? Iād suggest using just one of those Inputs to determine an alternate list if possible.
If you click on someoneās icon you should get a Message option.
You can use the dynamic list condition to determine which dynamic list is active.
Alternatively, I have had similar situations as you, and I handled it by loading the data into a DataTable from a BAQ, and then applying a filter, like in the example below. You can dynamically build the filter since it is just a string, so you can add however many drop downs they have filled to the filter.
bool BoxType = false;
try
{
var oTrans = ((InputControlValueBound<EpiTextBox, string>)Inputs["ChrHook1SheetMtlPart"].Value).Control.EpiTransaction;
object[] @params2 = new object[]
{
"ConfiguratorScreenPackageType",
0
};
var Filter = string.Format("Customer_CustID = '{0}'", Context.CustomerID);
System.Data.DataTable BAQResults = ProcessCaller.InvokeAdapterMethod(oTrans, "DynamicQueryAdapter", "GetQuerySearchResults", @params2) as System.Data.DataTable;
System.Data.DataRow[] MatchingRows = BAQResults.Select(Filter); //Use the Select method to find all rows matching the filter.
if (MatchingRows.Length > 0)
{
BoxType = (Boolean)(BAQResults.Rows[0][1]);
}
else
{
MessageBox.Show("Customer logo / no logo could not be loaded.");
}
}
catch (Exception e)
{
Inputs.ConfigurationFailed.Value = true;
var ErrMsg = String.Format("There was an unexpected error loading the customer packaging type (logo vs no logo). This configuration cannot be saved. Exception: {0}", e.ToString());
MessageBox.Show(ErrMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
return BoxType;
Waoh! Thank you Brendan. Itās clear, concise to the point. Awesome. I have learned a lot today. Thank you so much!
If you do want to filter based on all/some of those conditions Evanās answer is really cool! Thatās a better route to go if your situation is more complicated and would require huge, ugly IF/Else statements and a bunch of dynamic lists.
Evan, this is a whole new world you are opening! This is great! Thanks to you and Brendan, I think I have learned more in a few moments than I have in days of trial and error and using documentation that does not speak to me⦠Still brand new to this⦠Thank you for your great help!.
I ended up using the solution that Brendan proposed - it got me out of the bind I was in. I am brand new to C# and so I am not at peace with the syntax just yet. But Iāll study Evanās solution - the potential is great. Thank you again.
