private object GetWhereValue(LookupItem LookupItem) { const string SQL = "SELECT {0} FROM {1} WHERE {1}_ID={2}"; string table = Context.SourceDataTable.TableName; string sql = String.Format(SQL, LookupItem.WhereValue, table, LookupItem.Id); object result = Context.GetScalarValue(sql); return(result); }
internal string GetLookupResult(LookupItem LookupItem) { object whereValue = GetWhereValue(LookupItem); string result = "NULL"; if (whereValue != null) { Console.WriteLine(whereValue); result = whereValue.ToString().AddSingleQuotes(); } return(result); }
private string ProcessLookups(string value, int id) { string result = value; if (result.IndexOf("Lookup(") > -1) { List <string> lookupStrings = result.GetSubstringList("Lookup(", ")", true); foreach (string lookupString in lookupStrings) { LookupItem lookupItem = new LookupItem(lookupString); lookupItem.Id = id; string lookupResult = DataLookup.GetLookupResult(lookupItem); result = result.Replace(lookupString, lookupResult); } } return(result); }