Supercharge your RTP Validations with Groovy and Metadata Validation 2
Simplify RTP Validation with Groovy and Metadata Validation: Part 2
Many have asked how to check against all dimensions as a generic validation without having to create a variable for each dimension (and then create completely new logic for other cubes).
Validating RTP against Metadata
So, here’s my solution.
/*RTPS: {rtpMember}*/
// Create the message bundle
def mbUs = messageBundle (
["METADATA.MemberNameAlreadyExists":"Member Name {0} already exists. Please enter a different member name and try again."
] )
def mbl = messageBundleLoader(["en" : mbUs])
// validate rtpMember
validateRtp(rtps.rtpMember, {it -> !operation.application.getDimensions(operation.cube).collect({dim -> dim.hasMember(it, operation.cube)}).any({it == true})}, mbl, "METADATA.MemberNameAlreadyExists", rtps.rtpMember.EnteredValue)
// Member creation code goes here
Here’s what should happen
Let me know in the comments if this worked for you, or if you ran into any issues. Always good to get feedback.
See it on Medium
See it on LinkedIn