Configurator Lookup Table, can I do this?

I have a simple configurator lookup table, a small snippet of which is below;

image

I have a value from the configurator, and what I want to do is; if this value is >= MIN-VAL and <= MAX-VAL I want to return the BLADE-QTY.

Is this something that is possible?
Thanks in advance.

Hello Adrian,

It is possible but you’ll have to write some code to do it. I would recommend writing a BAQ to show what the record structure is like for Configurator Look-Up tables for guidance. Each record in that table represents a table name, a row, and a column - basically a cell in the table. Once you filter for the table name, then you’ll search for the values for the columns you’re interested in. AND THEN, you use those values to find the column(s) for the blade qty.

There are some helper functions but I don’t recall any that do ranges though.

1 Like

Like @Mark_Wonsil said - you’ll have to do some code.

From a different angle, we’ve been using a UD table or two to contain stacked data tables so we can do conditional queries like this. If you’re going to have to write some code, might as well write what you need. It’s a little more work to fill the dropdowns and such, but it’s not that bad. We use the lookups only for their originally intended purpose.

2 Likes

+1 on UD Tables. They are far more performant than the config tables.

1 Like

Hi Guys, thanks for taking the time to reply, I do agree about the UD Tables but I am under strict instruction to use the Lookup tables provided. Any way, after spending way to long on this I eventually managed to get something that works. I realized (luckily) that I only needed the MIN-VAL value, as the first row where it is less than my BS() value is the one I want. I could not get anything to work with the two criteria.
I have put what I did below, it may be of use to someone someday. Any advice / constructive criticism is more than welcome.
Thanks again


decimal x = 0;
int a = 0;
decimal b = Convert.ToDecimal(BS());
foreach ( var result in (from row in Db.PcLookupTblValues
where row.Company == Context.CompanyID
&& row.LookupTblID == "DG-BLADES"
select row))
{
if (result != null)
{	
	if (result.ColName == "MIN-VAL" && result.DataValueDecimal <= b)
	a = result.RowNum;
	
}
}
var nextresult = (from row in Db.PcLookupTblValues where row.LookupTblID == "DG-BLADES" && row.RowNum == a && row.ColName == "BLADE-QTY"
select row).FirstOrDefault();
if (nextresult != null)
x = nextresult.DataValueDecimal;
return Convert.ToInt32(x);

1 Like