SetFieldValueByName($fieldName, $value); } public static function FormatDatasetFieldsTemplate(Dataset $dataset, $template, IDelegate $processValue = null) { $result = $template; foreach($dataset->GetFields() as $field) { if ($dataset->IsLookupField($field->GetNameInDataset())) { $result = StringUtils::ReplaceVariableInTemplate( $result, $field->GetAlias(), $processValue == null ? $dataset->GetFieldValueByName($field->GetAlias()) : $processValue->Call($dataset->GetFieldValueByName($field->GetAlias()), $field->GetAlias()) ); } else { $result = StringUtils::ReplaceVariableInTemplate( $result, $field->GetName(), $processValue == null ? $dataset->GetFieldValueByName($field->GetNameInDataset()) : $processValue->Call($dataset->GetFieldValueByName($field->GetNameInDataset()), $field->GetNameInDataset()) ); } } return $result; } } ?>