locked
business rules - starts with RRS feed

  • Question

  • Hi

    I have an Entity which holds Name, Code, Number. Code should be a concatenated value of Number and a string value.

    I would like to have a business rule to check that the start of the Code is the same as "Number".

    I could use the "Starts with" condition, but then I have a problem with what action to use, since there is only a "is not valid" action.. and there is no action like "must contain" or "must start with".

    Any suggestions?

    Tuesday, September 14, 2010 5:08 PM

Answers

  • Ok I found a solution for me..

    I use "must contain pattern" and use the Code from "Number" (since it is a domain based attribute).
    Then in the same business rule I use "must contain pattern" again and have the attribute "[0-9]\|"

    That validates what I was looking for.. so my Code can be like "42|Hello"

    I had errors with "must contain pattern" first because I was trying to drag the whole domain based attribute "Number" to the rule instead of only the Code from "Number"...

    :-)

    • Marked as answer by Godpool Wednesday, September 15, 2010 12:21 PM
    Wednesday, September 15, 2010 12:20 PM

All replies

  • Ok I found a solution for me..

    I use "must contain pattern" and use the Code from "Number" (since it is a domain based attribute).
    Then in the same business rule I use "must contain pattern" again and have the attribute "[0-9]\|"

    That validates what I was looking for.. so my Code can be like "42|Hello"

    I had errors with "must contain pattern" first because I was trying to drag the whole domain based attribute "Number" to the rule instead of only the Code from "Number"...

    :-)

    • Marked as answer by Godpool Wednesday, September 15, 2010 12:21 PM
    Wednesday, September 15, 2010 12:20 PM
  • I was researching a solution but I think the one you came up with is a good one.  Very creative.

    Thanks,
    Brian Barnett - MSFT
    SQL Server MDS Team

    Wednesday, September 15, 2010 1:43 PM
  • Thanks

    It would have been better to be able to say "must start with" or "if doesn't start with" or something like that. As it is now it will validate if Code is "4|Hello42" and Number is 42, or if Code is "42|Hello" and Number is 2..

    Friday, September 17, 2010 4:21 PM