User Tools

Site Tools


enhancementexpressiona

#if #else 구문에서 or( || ) 구문 최소화 방법

* 일반적 방법

#if("$!dataRow.FOO" == '100' ||"$!dataRow.FOO" == '200' ||"$!dataRow.FOO" == '500' ||"$!dataRow.FOO" == '1900' ||"$!dataRow.FOO" == '2000' ||"$!dataRow.FOO" == '2300' ||"$!dataRow.FOO" == '2700' ||"$!dataRow.FOO" == '3000' ||........n)
  do something...
#else
  do something...
#end

* 대신 아래처럼 단축하여 사용할 수 있다.

#set($compare_values = ["100","200","500","1900","2000","2300","2700","3000"])
#if($compare_values.contains("$!dataRow.FOO"))
  do something...
#else
  do something...
#end
enhancementexpressiona.txt · Last modified: 2013/01/30 09:13 by lakystars