I’ve seen a few examples on the forum of people referencing UD Tables in product configurator but as far as I can see I don’t see any examples of how to actually do it.
I have a specific UD table (UD01) that contains specification information for a specific customer that drives the configuration we would use for them and I am wondering if someone could share a sample or some insights into how I can call that data to set fields in a configurator?
So I’ve never grabbed data from a UD table, but I have used code in the configurator On Load Event Expression to grab data from other tables. Have not found a way to do it within the “Design” tab though (like in an “On Field Changed” section of code). I believe you could call on the UD table like this and then set fields to it at the start of the configurator.
var ud01 = Db.UD01.Where(row => row.Key1 == "EXAMPLE").FirstOrDefault();
// Enter valid C# code and do not forget this method returns a decimal value.
var timeRow = ( from row in Db.UD39
where row.Company == Context.CompanyID &&
row.Key1 == Trailer.Substring(2) &&
row.Key2 == ModelYear &&
row.Key3 == Rev
select row).FirstOrDefault();
if (timeRow != null)
{
switch (OpId)
{
case "1":
return timeRow.Number01;
break;
case "2":
return timeRow.Number02;
break;
case "3":
return timeRow.Number03;
break;
case "4":
return timeRow.Number04;
break;
case "5":
return timeRow.Number05;
break;
case "6":
return timeRow.Number06;
break;
case "7":
return timeRow.Number07;
break;
case "8":
return timeRow.Number08;
break;
case "9":
return timeRow.Number09;
break;
case "10":
return timeRow.Number10;
break;
case "11":
return timeRow.Number11;
break;
case "12":
return timeRow.Number12;
break;
case "13":
return timeRow.Number13;
break;
case "14":
return timeRow.Number14;
break;
case "15":
return timeRow.Number15;
break;
case "16":
return timeRow.Number16;
break;
case "17":
return timeRow.Number17;
break;
case "18":
return timeRow.Number18;
break;
case "19":
return timeRow.Number19;
break;
case "20":
return timeRow.Number20;
break;
}
}
return -1m; // This ensures the job creates error with - time value so engineering can go look at why it is missing...
This is for combobox field changed event and uses UD Method to retrieve & update values:
// ========== ON Field Changed (Trailer Selection) ========
string ctlName = "cmbBoatYear"; // Just set this appropriately in each of changed events for the combos named below.
if (Inputs.bIgnoreEvents.Value == true) return;
string saveTitle = Pages.Page1.Title;
Pages.Page1.Title = "Selecting trailer. Please wait...";
Refresh.DynamicList(ctlName);
var ctrl=((InputControlValueBound<Ice.Lib.Framework.EpiUltraCombo,String>)Inputs[ctlName].Value);
if ((ctrl.Control.Rows.Count == 1) && (ctrl.Value != ctrl.Control.Rows[0].Cells[0].Text)) ctrl.Value = ctrl.Control.Rows[0].Cells[0].Text;
UDMethods.SelectTrailer();
Pages.Page1.Title = saveTitle;
EDITED: Sorry did not read original post entirely…