Helloโฆ
I believe what Iโm trying to accomplish is a composite key between a STATUS table that also references TABLENAME of the child table. Ultimately my goal is to have different statuses that have the same โNameโ but are used for different tables. In my STATUS table I have many different values that require a specific โContextโ. The Context property is a reference to the TABLENAME of the table that wants to use the status.
Here is an visual example of what Iโm talking about.
|
|
|
As you can see, I have โACTIVEโ listed as available choices for the OPERATORS table and the MACHINES table. When I create or edit an OPERATOR, I only want to see statuses that are applicable for that Context.
Is this possible?
Solved! Go to Solution.
All rows from the STATUS table that have a Context column value of OPERATOR
:
FILTER(
"STATUS",
("OPERATOR" = [Context])
)
All rows from the STATUS table that have a Context column value equal to the current view name:
FILTER(
"STATUS",
(CONTEXT("View") = [Context])
)
All rows from the STATUS table that have a Context column value occurs at the start of the current viewโs name:
FILTER(
"STATUS",
STARTSWITH(CONTEXT("View"), [Context]))
)
See also:
This makes no sense to me.
@Steve - Thatโs direct and honest. I appreciate that. Allow me to try againโฆ
I want a single table, STATUS, that is linked as a foreign key to several tables. In STATUS, I have a column of Code. The values of Code can be the โsameโ but mean different things based upon how status is used with the other tables. When Iโm creating or editing a record at the detail level, I want to show a list of only STATUS.Codes that pertain to that table.
Hereโs a better example (hopefully ;-))
Table: STATUS
Column: Code
Values:
ACTIVE - Pertains to MACHINES.Status
INACTIVE - Pertains to MACHINES.Status
ACTIVE - Pertains to OPERATORS.Status
INACTIVE - Pertains to OPERATORS.Status
ACTIVE - Pertains to OUTSIDE_SERVICES.Status
OPEN - Pertains to OUTSIDE_SERVICES.Status.
Did I do a better job explaining? I want to try to populate a dropdownlist with appropriate options that pertain to that table.
Whew! Thank you! I think Iโve got it: you want the Code column of the Status table to be tailored to the content of the Context column of the same row.
Valid If for Code column of Status table:
SWITCH(
[Context],
"MACHINES",
{"ACTIVE", "INACTIVE"},
"OPERATORS",
{"ACTIVE", "INACTIVE"},
"OUTSIDE_SERVICES",
{"ACTIVE", "OPEN"},
LIST()
)
See also:
@Steve - Wow! That looks amazing.
It appears that with your provided example, huge thank you btw, the Context and Code values are hard coded. Is there a way to have it be dynamic?
For instanceโฆ
If Iโm editing an OPERATOR and want to see all possible STATUSes where STATUS.Context = โthe_form_thats_doing_the_editingโ (in this case, OPERATOR) and have the function return Code values of โACTIVEโ and โINACTIVEโ?
All rows from the STATUS table that have a Context column value of OPERATOR
:
FILTER(
"STATUS",
("OPERATOR" = [Context])
)
All rows from the STATUS table that have a Context column value equal to the current view name:
FILTER(
"STATUS",
(CONTEXT("View") = [Context])
)
All rows from the STATUS table that have a Context column value occurs at the start of the current viewโs name:
FILTER(
"STATUS",
STARTSWITH(CONTEXT("View"), [Context]))
)
See also:
Thatโs exactly what I needed. Thanks @Steve
@Steve -
I took your expression of
FILTER(
"STATUS",
STARTSWITH(CONTEXT("View"), [Context]))
)
and it worked great for my โWORKORDERSโ form. However, if Iโm editing a row from a SLICE of the table โWORKORDERSโ I donโt get viable STATUSes. I can see that the Context I setup in STATUS wonโt match the name of my Slice (โCNCโ, โDAVโ, โHYDRโ in my case). The Slice(s) that I created all do pertain to DEPARTMENTS.
Do you think there is a way that I can union these two?
Is my overall table design flawed and Iโm trying to push a square peg in a round hole?
Please post a screenshot of the complete slice row filter expression.
Nevermind, @Steve. I took another approach to solve this problem. I made the Context field more generic.
User | Count |
---|---|
15 | |
11 | |
9 | |
8 | |
4 |