Configurator Dynamic List from Code

I have a UD method (GetMaterial) set up to link to a dynamic list in a config. It takes one string parameter (Type) and returns a string value (Material). What I ultimately want is to enter the type as a static parameter in the dynamic list and return the related material options.

UD Method code:
Material = string.Join("~", (from UD in Db.UD33 where UD.Belt_c.Contains(Inputs.chrBelt.Value) &&
UD.Type_c == Type && UD.Application_c.Contains(Inputs.cboApplication.Value) orderby
UD.Material_c select UD.Material_c).ToArray());
return Material;

I have the Dynamic List set up to return the material into my combo box and filter based on the Type:

The UD33 table shows the following data for “Hanger Brackets”:

This logic works perfectly, with one exception: once the configurator is closed or pages to the next page, the input is lost/cleared. I’m not sure why this is happening, and I can’t seem to find a way to ensure the inputs are saved. All of my other dynamic lists that do not take an additional parameter work as intended. Any ideas why this isn’t working?

The above will simply set the items of the dynamic list. I think you need to actually assign the combo’s value to one of the list items.

Wouldn’t this occur when the user makes their selection in the combo box?

No power so can’t get a proper example but the list has to be a pair of values. One is the value member and one is the display member. If I am reading your code and data correctly the list is just one vale between the ~.

Would you be able to provide an example?

// I do a bunch of stuff that would confuse things but this is the meat of things that takes the result of my query and builds a string with the results… You build a list of items where the value member is first separated from the display member using the tick character. Usually the tick character is the lower case result of the key that has the tilde character on it. Frequently next to the number 1 key on keyboard.

The value member comes from Key4 and the display member comes from character01. My routine allows me to dynamically specify the value member which is why I use a variable for the name of the column. In the example below I have hardcoded it.

StringBuilder MyList = new StringBuilder();
String valueMember = “Key4”; // just an example

// query = whatever you need to look up, query should have the value member and the display member in its set.
foreach(var line in query)
{
MyList.Append(line[valueMember]).Append(“").Append(line.Character01).Append("~"); } // if nothing is found it will return a string with "NNone” in it.
return ((MyList.ToString()).Length > 0)?(MyList.ToString()).Substring(0,(MyList.ToString()).Length -1):(“N`None”);