This Expression not working

not working this function why please suggest me .

11.PNGCapture.PNG

 

AND(AND(
OR(startswith([PUTWAY NO],"PUT"),LEN([PUTWAY NO]) = 8),
startswith([PUTWAY NO],"PT"),LEN([PUTWAY NO]) = 6),
startswith([PUTWAY NO],"ADJUST"),LEN([PUTWAY NO]) = 11)

ALL these statements are true:
....1: ALL these statements are true:
........1: ANY of these statements is true:
............1: (The value of column 'PUTWAY NO') starts with the text value ("PUT")
............2: (The text length of (The value of column 'PUTWAY NO')) is equal to (8)
........2: (The value of column 'PUTWAY NO') starts with the text value ("PT")
........3: (The text length of (The value of column 'PUTWAY NO')) is equal to (6)
....2: (The value of column 'PUTWAY NO') starts with the text value ("ADJUST")
....3: (The text length of (The value of column 'PUTWAY NO')) is equal to (11)
Test

 

Solved Solved
0 3 69
1 ACCEPTED SOLUTION

It's just a guess because I don't know what your business logic is, but the following might be what you're trying to achieve.

OR(
  AND(
    startswith([PUTWAY NO],"PUT"),
    LEN([PUTWAY NO]) = 8
  ),
  AND(
    startswith([PUTWAY NO],"PT"),
    LEN([PUTWAY NO]) = 6
  ),
  AND(
    startswith([PUTWAY NO],"ADJUST"),
    LEN([PUTWAY NO]) = 11
  )
)

 

View solution in original post

3 REPLIES 3

When you are writing a complex expression, especially one with multiple parenthesis and logic conditions, you should always indent it properly to see what is really happening. I have formatted your expression below and it seems pretty obvious where the issue might be:

AND(
  AND(
    OR(
      startswith([PUTWAY NO],"PUT"),
      LEN([PUTWAY NO]) = 8
    ),
    startswith([PUTWAY NO],"PT"),
    LEN([PUTWAY NO]) = 6
  ),
  startswith([PUTWAY NO],"ADJUST"),
  LEN([PUTWAY NO]) = 11
)

 You are asking for [PUTWAY NO] to start with "ADJUST" and have a length of 11 and start with "PT" and have a length of 6 and start with "PUT" or have a length of 8. It is not possible for any row to start with multiple values and have multiple lengths. You almost certainly need to rewrite this using different logic, probably with more OR conditions rather than AND.

It's just a guess because I don't know what your business logic is, but the following might be what you're trying to achieve.

OR(
  AND(
    startswith([PUTWAY NO],"PUT"),
    LEN([PUTWAY NO]) = 8
  ),
  AND(
    startswith([PUTWAY NO],"PT"),
    LEN([PUTWAY NO]) = 6
  ),
  AND(
    startswith([PUTWAY NO],"ADJUST"),
    LEN([PUTWAY NO]) = 11
  )
)

 

Thank you @graham_howe 

Top Labels in this Space