Action button display issues

I have a grouped action made up of 2 actions that applies to rows in table TackleBox:

Action 1: Adds data from a row in tackle box to table Rods
Action 2: Deep link using LINKTOROW to a form created from table Rods displaying the row of data just entered from Action 1.

I have the action display only on certain views by placing the following in the ‘Only if this is true’ portion of the behavior:

OR(
Context(“View”)=TackleBoxHarnessDetail,
Context(“View”)=TackleBoxWFSJigsDetail,
Context(“View”)=TackleBoxSpoonsDetail,
Context(“View”)=TackleBoxCranksDetail
)

The issue I am trying to solve is I want to add another condition to the ‘Only if this is true’ that evaluates the last row of a different table (Trips) to see if the column [Status] is “Fishing”

I changed the above to:

AND(
IN(Trips[Status], LIST(MAXROW(“Trips”, “_RowNumber”, [Status]=“Fishing”))),
OR(
Context(“View”)=TackleBoxWFSJigsDetail,
Context(“View”)=TackleBoxSpoonsDetail,
Context(“View”)=TackleBoxCranksDetail,
Context(“View”)=TackleBoxHarnessDetail
)
)

Although its gets a green light in the expression checker, the button never displays. Can anyone see my error?

Thanks!

First, this:

OR(
  Context(“View”)=TackleBoxHarnessDetail,
  Context(“View”)=TackleBoxWFSJigsDetail,
  Context(“View”)=TackleBoxSpoonsDetail,
  Context(“View”)=TackleBoxCranksDetail
)

is more efficiently expressed by this:

IN(
  CONTEXT(“View”),
  LIST(
    "TackleBoxHarnessDetail",
    "TackleBoxWFSJigsDetail",
    "TackleBoxSpoonsDetail",
    "TackleBoxCranksDetail"
  )
)

Yours isn’t wrong, it’s just not as efficient as it could be (in case you care).

Looking at this:

TRIPS[Status] produces a list of all Status column values in the TRIPS table. MAXROW(...) produces the key column value of the row of the Trips table that has the highest _RowNumber column value from among those rows having a Status column value of Fishing. I doubt this is your intention. I suspect what you want is:

IN(
  "Fishing",
  SELECT(
    Trips[Status],
    ([_ROWNUMBER] = MAX(Trips[_ROWNUMBER]))
  )
)

which answers the question, “is Fishing the Status of the newest row in Trips?”

All combined:

AND(
  IN(
    CONTEXT(“View”),
    LIST(
      "TackleBoxHarnessDetail",
      "TackleBoxWFSJigsDetail",
      "TackleBoxSpoonsDetail",
      "TackleBoxCranksDetail"
    )
  ),
  IN(
    "Fishing",
    SELECT(
      Trips[Status],
      ([_ROWNUMBER] = MAX(Trips[_ROWNUMBER]))
    )
  )
)
3 Likes

Thanks so much @Steve! Your solution worked perfectly!! I certainly care about efficiency as well! Why is setting the views within the IN() and LIST() expressions more efficient than the OR() expression?

1 Like

The OR() expression (potentially) has to reload the CONTEXT("View") value once for each comparison, whereas IN() only does it once. In this case, the win is trivial, but in some cases the win could be dramatic. I prefer the efficient path unless there’s a reason not to.

1 Like

Excellent! Thanks!

1 Like