I have a child table with phone numbers. In the parent table I have a field called default phone number that allows the user to select a default phone number from the list of numbers in the child table.
I use the following Valid_if expression for this:
SELECT(Phone_Numbers[Phone Number:], [Company:] = [_THISROW].[KEY:])
This works, but I want the default phone number to be entered automatically if there is only 1 phone number in the child table.
I have used the following App formula expression:
IF(COUNT(SELECT(Phone_Numbers[Phone Number:], [Company:] = [_THISROW].[KEY:])) = 1, ANY(SELECT(Phone_Numbers[Phone Number:], [Company:] = [_THISROW].[KEY:])), โโ)
The expression works in the sense that a default phone number automatically gets picked when there is only one phone number. However, when there is more than one phone number in my child table, the default phone number field disappears completely.
I was hoping that the โโ part in my expression would leave the field blank and that it would allow me to select a default phone number manually.
Any help would be much appreciated.
Solved! Go to Solution.
@Guillermo_Perez
You can construct your expression like this:
[INITIAL VALUE]
IFS(
COUNT(SELECT(Phone_Numbers[Phone Number:], [Company:] = [_THISROW].[KEY:])) = 1,
ANY(SELECT(Phone_Numbers[Phone Number:], [Company:] = [_THISROW].[KEY:]))
)
[SUGGESTED VALUES]
IFS(
COUNT(SELECT(Phone_Numbers[Phone Number:], [Company:] = [_THISROW].[KEY:])) > 1,
SELECT(Phone_Numbers[Phone Number:], [Company:] = [_THISROW].[KEY:])
)
Another approach might be like this:
This approach will put the phone numbers into a dropdown even itโs only one and always select the 1st value on the list as an initial value.
[INITIAL VALUE]
ANY(SELECT(Phone_Numbers[Phone Number:], [Company:] = [_THISROW].[KEY:]))
[SUGGESTED VALUES]
IFS(
COUNT(SELECT(Phone_Numbers[Phone Number:], [Company:] = [_THISROW].[KEY:])) >= 1,
SELECT(Phone_Numbers[Phone Number:], [Company:] = [_THISROW].[KEY:])
)
User | Count |
---|---|
15 | |
12 | |
9 | |
8 | |
4 |