Good day everyone,
I hope you can help me. I have a table TRANSACTIONS and I want to identify easily the โINCOMESโ and the โEXPENSESโ, so I have a column [transactionType] which is an enum with those two values.
Then, I want to add 2 buttons โAdd Incomeโ and โAdd Expenseโ which both use the same table.
I was wondering if there is a way to pre-fill the value of [transactionType] based on the the pressed button, so if someone presses โAdd Incomeโ, then [transactionType]=โINCOMEโ, and if someone presses โAdd Expenseโ then [transactionType]=โEXPENSEโ.
Is it there a way to achieve this?
Solved! Go to Solution.
Thank you for all the details.
Presuming you mean primary views by the above and โAdd Incomeโ and โAdd Expenseโ are two form type views, please explore having an expression like following in the initial value of [transactionType] . You could also keep this [transactionType] column hidden.
IFS(CONTEXT(โViewโ)=โAdd Incomeโ , โINCOMEโ , CONTEXT(โViewโ)=โAdd Expenseโ , โEXPENSEโ)
It sounds from your post heading that you probably wish to prefill a button with a value depending on the view.
Could you please add more details to your requirement? Somehow, it sounds that the [transactionType] column values and
are probably one and the same.
Thank you @Suvrutt_Gurjar
Iโll try to re-phrase my previos question.
I want to have 2 views which are almost identical since both views are for adding a โtransactionโ into the TRANSACTIONS table.
But, I have 2 types of transactionsโฆ โIncomesโ and โExpensesโ (and that is the main difference). I differ them by having a column [transactionType] which is an Enum that can be either โINCOMEโ or โEXPENSEโ.
Then, I want to have 2 viewsโฆ one to โAdd Incomeโ and another to โAdd Expenseโ, and I want them to show on the bottom of the scree as 2 buttons.
What I wish, is that if the user hits on the โAdd Incomeโ button, the view will be displayed and the [transactionType] would be already selected as โINCOMEโ.
In similar way, when the user will hit the โAdd Expenseโ button, then the view will be displayed and the [transactionType] would be already selected as โEXPENSEโ.
Eventually, the idea is to even not show the [transactionType] in the view (as long as the proper values are pre-filled, depending on the button the user is hitting).
All of this is just to prevent the user would be wrongly adding an โincomeโ but by mistake have the [transactionType] as โEXPENSEโ (or viceversa).
I hope that this explains better my user case.
Thank you for all the details.
Presuming you mean primary views by the above and โAdd Incomeโ and โAdd Expenseโ are two form type views, please explore having an expression like following in the initial value of [transactionType] . You could also keep this [transactionType] column hidden.
IFS(CONTEXT(โViewโ)=โAdd Incomeโ , โINCOMEโ , CONTEXT(โViewโ)=โAdd Expenseโ , โEXPENSEโ)
Thank you @Suvrutt_Gurjar as usual, your tips were very helpful! it worked like a charm!
You are welcome. Please refer below article for a quick reference just in case you have already not.
User | Count |
---|---|
17 | |
10 | |
7 | |
5 | |
5 |