Precisely Enterworks

 View Only
  • 1.  Validation Rule for Shipping Dimensions

    Posted 05-10-2022 15:58
    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
    ------------------------------


  • 2.  RE: Validation Rule for Shipping Dimensions

    Employee
    Posted 06-16-2022 11:11
    Hi Brittany 
    Please reach out to EnterWorks support.  It looks like this isn't getting picked up in the EnterWorks Forum.
    Best Regards,
    Sigrid


    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 3.  RE: Validation Rule for Shipping Dimensions

    Employee
    Posted 06-17-2022 03:55
    Brittany,

    The VTL rule capability is for calculating a value and updating an attribute with its value.  You could use it to calculate the total dimensions for the package and store that in an attribute representing that and then defining a simple validation rule that requires that value to be less than or equal to 165.

    Another approach you can take is to define a Bulk Callout Rule that uses SQL to calculate the dimension and produce an error if it is greater than 165.  It would only be necessary to have one attribute with this rule, so it could either be one of the three dimension attributes or another related attribute (and the error message would clearly state that the dimension attributes need to be updated).

    Yet another approach would be to define a Change Notification rule that does the calculation (using SQL) and updates an attribute with that calculation and the simple rule described above can be applied to that attribute.

    The logic for the VTL or SQL calculation would need to determine which is the longest dimension, then double the other two and add them all together.

    -Brian

    ------------------------------
    Brian Zupke | Senior Technical Support Engineer
    Winshuttle North America | 909-900-9179
    ------------------------------



  • 4.  RE: Validation Rule for Shipping Dimensions

    Posted 06-17-2022 08:15
    Brian, 

    Thank you very much for your feedback, I had been working on a solution that is similar to your first suggestion and it seems to be getting us in the right direction. I will plan to test through your other approaches as well. Thanks again!

    ------------------------------
    Brittany Adams | Data Management Steward
    DAS Companies
    ------------------------------