skip to Main Content

I am using a Condition Action in my Azure LogicApps.
Currently I am only checking if "PersonNr" ends with "0000".
This is how it looks:
enter image description here

The value I get is a 12 digit birth number, SSN. For example: 199206243767
That is yyyyDDmmxxxx.

I want a condition that checks if the value I receive has a string with 12 characters. If it’s less than 12 then it’s wrong and I do not want it but there does not seem to be any option for this.
Using the length() expression does not work either.

What’s more.. I would also like to check if all the characters if the 12char string value is only 0-9. If there are any letters I do not want it.

I tried adding "length()" expression — Is equal to — "12" and also an expression that says string(12)
I thought it would check if the value i received has 12 characters but instead this error:
"’The template language function ‘length’ expects one parameter: an array or a string the length of which is returned. The function was invoked with ‘0’ parameters. Please see https://aka.ms/logicexpressions#length for usage details.’."

2

Answers


  1. Chosen as BEST ANSWER

    My issue was a simple one and I've now solved it, thanks to "Skin" for helping me rethink.

    When trying to add a length() expression I used the value of the compose action above. What I needed to do was to go step further and check it from the current for each loop values.

    Originally I had this expression: "length(outputs('Compose')?['persorgnr'])"

    It resulted in an error.

    The expression that worked was this: length(items('For_each_ResultSet')?['persorgnr'])

    Thanks again to Skin for replying, it helped me realize my error.


  2. If you want to check if your string is a number, you can use isInt() or isFloat(). For your situation, isInt() is better but your number is too large for that so you need to use isFloat().

    IsNumber

    This is the expression …

    isFloat(variables('Numbers String'))
    

    … and this is the result …

    IsNumber

    … you can then do what you need from there, you can even use that expression directly within a condition.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search