none
<> in PQ RRS feed

  • Question

  • Hi : I am trying to use <> inside a if statement and its not working properly in PQ. May be I am doing something wrong. Any help would be greatly appreciated.  In the Final Working Days Column the result should be "Rest Day" as circled below. Thanks

    Sunday, July 28, 2019 11:45 AM

Answers

  • Hi M.Awal,

    I was hoping that you would have been able to solve the issue on your own before any responses were forthcoming. The reason being that by a very, very, very long way, you have become the most prolific questioner that this forum has ever seen. It suggests to me that you don't take sufficient time to figure something out, thereby making it hard to advance in the language. If you search this forum, you will notice that in over 5 years, I have asked only a few questions. I spent the rest of the time figuring things out. :)

    Anyway, the statement:

    "and its not working properly"

    is incorrect because the logic follows your 'if' expression exactly.

    For the row in question:

    if [#Helper-1"] <> "Rest Day" is false, since "Rest Day" is in the cell.
    if [Holiday] <> null is true because there is a value in the cell

    false and true = false, so the following 'else' statement is evaluated:

    if [#Helper-1"] <> "RDO" is true because "Rest Day" is in the cell
    if [Holiday] <> null is true because there is a value in the cell

    true and true = true so the 'then' portion is evaluated, which evaluates to "PH", as shown in the cell.

    Once the predicate evaluates to true, no further evaluation is done - the final else expression is not evaluated.

    Suggestion - Spend a bit of time trying to figure out the correct logic you need. :)

    • Proposed as answer by Aleksei Zhigulin Sunday, July 28, 2019 7:56 PM
    • Marked as answer by M.Awal Sunday, July 28, 2019 9:45 PM
    Sunday, July 28, 2019 5:29 PM

All replies

  • Hi!

    Your code should work, I guess, there may be redundant spaces or non-printable characters in Helper-1 column.

    Sunday, July 28, 2019 1:55 PM
  • Hi M.Awal,

    I was hoping that you would have been able to solve the issue on your own before any responses were forthcoming. The reason being that by a very, very, very long way, you have become the most prolific questioner that this forum has ever seen. It suggests to me that you don't take sufficient time to figure something out, thereby making it hard to advance in the language. If you search this forum, you will notice that in over 5 years, I have asked only a few questions. I spent the rest of the time figuring things out. :)

    Anyway, the statement:

    "and its not working properly"

    is incorrect because the logic follows your 'if' expression exactly.

    For the row in question:

    if [#Helper-1"] <> "Rest Day" is false, since "Rest Day" is in the cell.
    if [Holiday] <> null is true because there is a value in the cell

    false and true = false, so the following 'else' statement is evaluated:

    if [#Helper-1"] <> "RDO" is true because "Rest Day" is in the cell
    if [Holiday] <> null is true because there is a value in the cell

    true and true = true so the 'then' portion is evaluated, which evaluates to "PH", as shown in the cell.

    Once the predicate evaluates to true, no further evaluation is done - the final else expression is not evaluated.

    Suggestion - Spend a bit of time trying to figure out the correct logic you need. :)

    • Proposed as answer by Aleksei Zhigulin Sunday, July 28, 2019 7:56 PM
    • Marked as answer by M.Awal Sunday, July 28, 2019 9:45 PM
    Sunday, July 28, 2019 5:29 PM
  • Hi Colin: Thanks for the pointers. After reading your comment, when I realised where is it going all wrong. Then I figured out how it should be written. 

    Monday, July 29, 2019 10:55 AM
  • Glad to know that you were are to solve your problem. :)
    Monday, July 29, 2019 4:00 PM