Forum Discussion

kheatley's avatar
kheatley
Qrew Member
13 days ago

If/then formula?

Need help with an if/then formula or what I assume is the best way to get the data I need.

I have a vacation request submitted into one table that is linked to decision table that needs 5 signatures before it is approved.

Currently, I have the status field in the vacation table that is:

If([# of decision records] = 5, "APPROVED", "PENDING APPROVAL")

Will this work per request?  Or do I also have to include record# or something in the if statement.

Thanks for any advice/help.

  • If [# of decision records] is a Summary field between  the two tables, that will work.

    Question,  can a decision record have a value of Denied?   The first four might be Approved but the last one is not.   If that is the case your Summary formula needs another piece to it so it is counting Approved Decisions and not all Decisions.

    • kheatley's avatar
      kheatley
      Qrew Member

      Yes it can.  I actually just changed this.  Not sure if it works yet because I haven't tested it.

      If([# of Decision records] = 5, "APPROVED", 
         If([Decision - Decision] = "Rejected", "REJECTED", "PENDING APPROVAL"))

      Update: crud.  looks like it didn't work.

      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend

        You can put a filter on the summary field to only count approved decisions.  The also maybe a notification off the decisions table for a rejection.

  • Are you saying you have a relationship where one vacation request has 5 child decision record.  Then you created a summary field on that relationship?  Does the Summary field have a filter to ensure it's only counting decision records which have been approved?

    Also, what if the same person approves twice?

    • kheatley's avatar
      kheatley
      Qrew Member

      I am color coding decision field so they will only be looking for records that aren't green.      

      If([# of Decision records] = 5, "APPROVED", 
         If([Decision - Decision] = "Rejected", "REJECTED", "PENDING APPROVAL"))

      Is there something wrong with logic of this if/then statement on my status field above?  It works for Approved and Pending but not for Rejected.

  • Silly question but where does the field [Decision - Decision] come from?   Row 1 is your Summary Field, it has precedence in your logic.

    Your If statement defaults to Pending so [Decision - Decision] could be null. Cancelled or any value but Rejected and it will say PENDING.

    • kheatley's avatar
      kheatley
      Qrew Member

      Comes from Decision table, is a dropdown of Approved, Rejected, linked via relationships to vacation request table.

      • DonLarson's avatar
        DonLarson
        Qrew Elite

        How about this:

        If([# of Decision records] = 5, "APPROVED", [Decision - Decision])