Forum Index

No notifications
Notifications

Favorites

No favorites found
General Training Discussion General chat and comment on KnowledgeKube training
KnowledgeKube Training > General Training Discussion > Change row Output of Derived Column in Data Source Grid View modes: 
User avatar
KnowledgeKube Staff
KnowledgeKube Staff
matt.pitman - 27/09/2016 11:38:38
   
RE:Change row Output of Derived Column in Data Source Grid
Happy to help!

User avatar
Advanced member
Advanced member
   
RE:Change row Output of Derived Column in Data Source Grid
Alright, it works! Thanks!

User avatar
KnowledgeKube Staff
KnowledgeKube Staff
matt.pitman - 27/09/2016 11:18:45
   
RE:Change row Output of Derived Column in Data Source Grid
The Derived column will return the result of the final statement to be parsed in the expression. When I tested this I got 1 or 0 in my derived column, signifying whether the If statement resolved to True or False. To get the desired result, you will need to assign the result of your FormatString statements to a new variable, and write the name of that variable as a final statement, followed by a semicolon. For example:
if:(Mod(Id,2) = 1)
{
	VARResult:= FormatString(CustomVariable1,"Image,Body");
}
else
{
	VARResult:= FormatString(CustomVariable2,"Body,Image");
}
VARResult;
Notice that I've also placed the Modulo expression inside the If statement's condition? The effect is the same without needing to assign its result to a variable and then evaluate it. Feel free to follow this suggested change if the variable is not used elsewhere. Edit: Updated code to include FormatString.

User avatar
Advanced member
Advanced member
   
RE:Change row Output of Derived Column in Data Source Grid
I tried changing 0 into 1, but the output was a table with values of 0 and 1. It only displayed the value of the modulo result not the format strings.

User avatar
Advanced member
Advanced member
   
RE:Change row Output of Derived Column in Data Source Grid
Oh I'm sorry I got a typo, I edit again the expression. I used 0 in checking modulo for odd and even numbers.

User avatar
KnowledgeKube Staff
KnowledgeKube Staff
matt.pitman - 27/09/2016 11:05:01
   
RE:Change row Output of Derived Column in Data Source Grid
Hi again Manny, Try changing if:(VARModulo = 2) to if:(VARModulo = 1) and see if that helps. If not, let me know and I'll investigate further. Kind regards.

User avatar
Advanced member
Advanced member
   
RE:Change row Output of Derived Column in Data Source Grid
Derived Column's Expression: VARModulo := Mod(Id, 2); if:(VARModulo = 0) { FormatString(CustomVariable1,"Image,Body"); } else { FormatString(CustomVariable2,"Body,Image"); } Id is a DataSourceGrid keyword.

User avatar
KnowledgeKube Staff
KnowledgeKube Staff
matt.pitman - 27/09/2016 10:36:14
   
RE:Change row Output of Derived Column in Data Source Grid
Hi Manny, If you are happy to post your expression here in a public, please do so I can take a look and see if I can recreate the issue. Otherwise, feel free to e-mail the expression to me. Kind regards.

User avatar
Advanced member
Advanced member
   
Change row Output of Derived Column in Data Source Grid
Hi, Is there a way to change the row output in a Derived Column of Data Source Grid? Like I want that ODD rows will have an output of Image and Text then all EVEN rows will have an output of Text and Image. I tried using an if else on the derived columns expression but failed to return the desired output. Thanks!

RSS Feed