Action button display issues

GW375
New Member

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!

Solved Solved
0 4 191
1 ACCEPTED SOLUTION

Steve
Platinum 4
Platinum 4

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]))
    )
  )
)

View solution in original post

4 REPLIES 4

Steve
Platinum 4
Platinum 4

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]))
    )
  )
)

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?

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.

GW375
New Member

Excellent! Thanks!

Top Labels in this Space