Hello,
Regrettably, it is not possible to access the previous displayed record. However, there is a simple work-around.
You can create a two methods
setWord,
getWord that would set and get the
LocationName to the
RequestStockHelper class so that you can access the
LocationName of previous row.
public static string setWord(object input)
{
string word = ValidationHelper.GetString(input, String.Empty) ;
CMS.GlobalHelper.RequestStockHelper.Add("value", word);
return "";
}
public static string getWord()
{
string word = ValidationHelper.GetString(CMS.GlobalHelper.RequestStockHelper.GetItem("value"), String.Empty);
return word;
}
Third custom method would simply compare the current
LocationName and the previous one (retrieved by the
getWord method):
public static string compareStrings (object currentInput, object previousInput)
{
string currentWord = ValidationHelper.GetString(currentInput, "") ;
string previousWord = ValidationHelper.GetString(previousInput, "");
if ( !previousWord.Equals("") && !currentWord.Equals(""))
{
// check first letter of both variables and return currentWord with a space if necessary
}
return currentWord;
}
Then, your transformation could look like this one:
<%# MyFunctions.compareStrings( Eval("LocationName"), MyFunctions.getWord() ) %>
<%# MyFunctions.setWord( Eval("LocationName ") ) %>
For more information about custom transformation method, I would like to point you to the following article:
Adding custom functions to transformationsBest regards,
Michal Legen