Hello everyone,
I have a form view for adding a new record on the table TRANSACTIONS where there is a column TRANSACTIONS[transactionAccount] which is a reference of another table ACCOUNTS.
In the form view, the TRANSACTIONS[transactionAccount] column appears as a dropdown list.
I want to know if there is a way to display such list in a different order, by the โmost usedโ accounts.
For instance, in the ACCOUNTS table, I was able to add a โread-onlyโ virtual column [accountTransactionsCount] like this:
COUNT(
SELECT(TRANSACTIONS[transactionKey],[transactionAccount]=[_THISROW].[accountId])
)
So this virtual column tells me the number of occurrences of the [accountId] in the TRANSACTIONS table ,and so, I can tell from that which ones are the accounts that are โmost usedโ.
I just donโt know how I could use this ACCOUNTS[accountTransactionsCount] virtual column for sorting the dropdown list in the form view.
Would anyone know if this is possible and if so how? Thank you! Carlos
Solved! Go to Solution.
Thank you Steve!
If anyone is having a similar issue than me, the problem was that in the second argument I was including the name of the table โACCOUNTSโ which seems that is not needed (and it even was causing problems).
So, in the end, this is what I have, and now it works as expected!
ORDERBY(
ACCOUNTS[accountId],
[accountTransactionsCount],
TRUE
)
Thank you @Marc_Dillon ,
Iโm just not sure how to use this ORDERBY() function so the drop-down list in the form view will be displayed in the order Iโm expecting.
Could you please elaborate a bit more on how to use this fiction to achieve the result that Iโm trying to get with the form view?
Hello @Marc_Dillon I tried to follow the advice on the page you had linked, but it didnโt seem to have worked.
This is what I did:
On the TRANSACTIONS table, I went to edit the [transactionAccount] column which is a reference of the ACCOUNTS table (which has the [accountId] column).
Then, I added this formula under the โData Validity โ Valid Ifโ field of the TRANSACTIONS[transactionAccount] column:
ORDERBY(
SELECT(ACCOUNTS[accountId],TRUE),
ACCOUNTS[accountTransactionsCount],
TRUE
)
I saved the changes, but when I open the form view to add a new transaction, and I click on the Accounts field, the dropdown still displays in the order the accounts are in the source spreadsheet (not even in alphabetical order).
What would I be missing?
To better show the issue that Iโm having, I had created a virtual column which I called ACCOUNTS[accountLongName] and that Iโm using as the โLabelโ which has this formula:
[_RowNumber]&" - "&[accountName]&" ("&[accountTransactionsCount]&")"
So, as you can see from the screenshot below, the dropdownlist in the form view still is ordered by the [_RowNumber] instead of the [accountTransactionsCount]
My case is quite similar to @Diogenes_ASBL_VZW case in here:
Iโve tried using the ORDERBY as @Grant_Stead had suggested in there, in this way:
On the column TRANSACTIONS[transactionAccount], which is of type โRefโ to the ACCOUNTS table, Iโve added this formula under the โData Validity โ Valid Ifโ formula field:
ORDERBY(
ACCOUNTS[accountId],
ACCOUNTS[accountTransactionsCount],
TRUE
)
But Iโm still not getting the result that Iโm expecting.
Iโm sure there might be something simple that Iโm missing in the whole process, but Iโm not able to figure out what it isโฆ
Your ORDERBY() expression is wrong. Please review the docs and correct the second argument, ACCOUNTS[accountTransactionsCount]
.
Thank you Steve!
If anyone is having a similar issue than me, the problem was that in the second argument I was including the name of the table โACCOUNTSโ which seems that is not needed (and it even was causing problems).
So, in the end, this is what I have, and now it works as expected!
ORDERBY(
ACCOUNTS[accountId],
[accountTransactionsCount],
TRUE
)
Well done!
User | Count |
---|---|
16 | |
12 | |
5 | |
5 | |
5 |