none
Generate Unique Value RRS feed

  • Question

  • MIMWAL Team,

    Is there a way to check the value of the UniquenessKey before deciding what to set the Value Expression? I haven't had much luck with: IIF(GreaterThan(Length([//UniquenessKey]), 10)), do-something-if-true, do-something-if-false

    Appreciate any thoughts/feedback on this.

    Cheers,


    Tom Houston, UK Identity Management Practice

    Monday, February 24, 2020 12:25 PM

Answers

  • I was assuming you were getting a runtime error. At least for the error that you are getting that is preventing the saving itself, the error message is pretty clear :)

    GreaterThan(Length([//UniquenessKey]), 10) would be true only if //UniquenessKey]  is greater than "9999999999". Not sure if that is what you had in mind.

    • Marked as answer by Thomas Houston Wednesday, February 26, 2020 12:57 PM
    Monday, February 24, 2020 4:25 PM
    Owner

All replies

  • Have not tried this myself, but you should be able to use it any valid WAL expression. Note that //UniquenessKey evaluates to a string, e.g. "2" and not a number e.g. 2, so you need to explicitly convert it to a number first.

    The expression, GreaterThan(Length([//UniquenessKey]), 10) would be true for a very big 11 digit number and that is probably your issue? Have you tried ConvertToNumber instead of Length function?


    Monday, February 24, 2020 2:39 PM
    Owner
  • Many thanks Nilesh,

    If [//UniquenessKey] evaluates to a string, then the 'Length' function should work because it returns the length of a string (rather than an int), so I don't think converting it to a number will help?

    When I try and save the 'Generate Unique Value' activity with this expression, I get a message saying "The expression 'GreaterThan(Length([//UniquenessKey]), 10))' contains an unexpected number of '(' or ')' characters and is invalid.

    Tom Houston, UK Identity Management Practice

    Monday, February 24, 2020 3:05 PM
  • I was assuming you were getting a runtime error. At least for the error that you are getting that is preventing the saving itself, the error message is pretty clear :)

    GreaterThan(Length([//UniquenessKey]), 10) would be true only if //UniquenessKey]  is greater than "9999999999". Not sure if that is what you had in mind.

    • Marked as answer by Thomas Houston Wednesday, February 26, 2020 12:57 PM
    Monday, February 24, 2020 4:25 PM
    Owner
  • Got there in the end!

    IIF(GreaterThan(ConvertToNumber([//UniquenessKey]), 10), do-something-if-true, do-something-if-false, default

    Thanks for the pointers @Nilesh. Much appreciated.

    Cheers,

    Tom Houston, UK Identity Management Practice

    Wednesday, February 26, 2020 12:56 PM