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! Go to Solution.
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]))
)
)
)
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.
Excellent! Thanks!
User | Count |
---|---|
40 | |
28 | |
22 | |
20 | |
15 |