I have a Product table and a Line Item table. The dependent dropdown works but if I only have one product with that category I want it to auto select the product for me. Is this possible?
Solved! Go to Solution.
If I understand your requirement correctly, here is what you can try.
In the initial value of id_product column in Line Item, put an expression like,
IF(
COUNT(
FILTER(
"Product",
[Category] = [_THISROW].[Category]
)
) = 1,
LOOKUP(
[_THISROW].[Category],
"Product",
"Category",
"Id"
),
""
)
Also set rest on edit.
Hi @NCD
yes, here:
Define App formulas and Initial values - AppSheet Help
You may want to use a ANY(yourlist) expression.
don't quite get it :S
So my Category column in my Line Item table is set to Enum and I have a valid if expression;
Product[Category]
And Enum type Ref for my id_Product and a valid if expression;
Product[id]
you're saying I should have ANY() where? and by (yourlist) meaning id_Product?
In the initial value field:
Maybe this:
ANY(Product[Category])
If I understand your requirement correctly, here is what you can try.
In the initial value of id_product column in Line Item, put an expression like,
IF(
COUNT(
FILTER(
"Product",
[Category] = [_THISROW].[Category]
)
) = 1,
LOOKUP(
[_THISROW].[Category],
"Product",
"Category",
"Id"
),
""
)
Also set rest on edit.
Thank you!
User | Count |
---|---|
35 | |
30 | |
30 | |
20 | |
18 |