Getting Data from UDxx Table When Not All Five Keys Are Known

Thanks so much for the good effort, Kevin. If anything, you encouraged me to keep trying other methods. Here’s what I ended up with:

private decimal GetUD23Num(string colName, int ordNum, int cusNum, string pproID)
{
	decimal colValue = 0;
	bool recSelected = false;
	if(colName == "") return colValue;
	string ordStr = ordNum.ToString();
	string cusStr = cusNum.ToString();
	int invNum = FetchInvoiceNumFromOrder(ordNum);
	string invStr = invNum.ToString();
	
	string whereClause = String.Format("Key1 = '{0}' AND Key2 = '{1}' AND Key3 = '{2}'",ordStr,invStr,cusStr);
	DataSet dsUD23 = SearchFunctions.listLookup(this.oTrans, "UD23Adapter", out recSelected, false, whereClause);
	if(recSelected)
	{
		DataRow adapterRow = dsUD23.Tables[0].Rows[0];
		colValue = Convert.ToDecimal(adapterRow[colName]);
	}
	return colValue;
}

Cheers,
Tony G.
1 Like