Hello,
Our business would like to implement a validation rule on an attribute that holds data for packaging.
We would like to flag this attribute if it meets the below condition:
- Any package measuring more than 165 inches in length and girth combined: L + [(H x 2) + (W x 2)]
We have three attributes that hold dimensions, the longest dimension ("L") is not always in a specific field. So, my goal is to have a rule that can determine the largest number out of those three fields and then perform the above equation. If that number is greater than "165" the rule fires.
I thought a VTL rule would be the best option, so I have been tweaking the code below to pull out the longest dimension. I am self-teaching VTL coding so it may look a little confusing, fair warning!
#set($st="")
#set($mt =$st.getClass().forName("org.apache.velocity.tools.generic.MathTool").newInstance())
#if(${Item_Staging.Packaged Item Depth (in)} > ${Item_Staging.Packaged Item Height (in)} && ${Item_Staging.Packaged Item Width (in)})
//Needs adjusted, just want data - not a comparison#set($max = -10000)
#if($val > $max)
#set($max = $math.max($max,$val))
#end
$max
#end
Any tips or suggestions would be greatly appreciated!
Thank you,
------------------------------
Brittany Adams | Data Management Steward
DAS Companies
------------------------------