Is it possible for the user to specify the type of currency in the app sheet?
I am developing an app for the stock market. I want the user to be able to choose the default currency symbol (For example between: $, โฌ and ยฃ). The audience of this app will be users from different countries and everyone will input the price with the currency of their country.
I am almost certain that App Sheet does not have such a possibility by default. So I will be happy if you share with me any idea that comes to your mind to solve this problem.
Solved! Go to Solution.
User[Currency] ="$" is an incorrect syntax. The expression User[Currency] will select a list of all rows of the table for the currency column (Please refer the below help article and screenshot from it) . And then one cannot compare a list with a single text value "$" in this case) That is the precise error , the screenshot is showing.
List expressions - AppSheet Help
Your expression needs to be something like
INDEX(SELECT(User[Currency], [Email]=USEREMAIL()), 1) ="$"
This will dynamically select the user record for the current user based on her/his USEREMAIL()
Couple of more things to note.
1) Instead of always using bulky expressions such as above (INDEX(SELECT(User[Currency], [Email]=USEREMAIL()), 1) ="$") for selecting any column for the logged in user from the User table, you could use the epic "Current User" system tip by @MultiTech referred below.
Current User (Slice) | How to conform your app a... - Google Cloud Community
Then your format rule expression will become
INDEX(Current_User[Currency], 1)="$"
2) Please desist from having expensive expressions in the format rules as they tend to slow down the app. You may want to explore how you can auto select the user's currency in a column while filling up a form etc. You could possibly use "Initial Value" option to pre select the currency of the user and use that column in the format rules.
@MaisamFathi wrote:
. I want the user to be able to choose the default currency symbol (For example between: $, โฌ and ยฃ)
One option you may want to try is to set all the price columns as decimal type columns with 2 decimal digits. Then depending on the user's location you could assign format rules for the decimal columns. Format rule icons do have symbols for ( $, โฌ and ยฃ). So in your case this workaround would be possible.
The example below has price columns defined as decimal columns and format rules of $ and ยฃ symbols applied to them.
I have of course not tested it extensively for all scenarios. So you may want to test it a bit more for feasibility. Some rough edges I saw were the group by column does not display the format rule. So there could be more such edge cases. But in general,it could be used if it fits the app design by and large.
Format rule symbols seem to be available for a handful of currencies.
@Suvrutt_Gurjar Thanks for suggesting this great solution. But I still haven't been able to use it well!
I created a column to select the currency in the User table.
Then, in the "If this condition is true" field in the Format Rules, I entered the following condition:
User[Currency]="$"
I want to create this Format Rule for the "List" table. But because the Currency value is in a "User" table, the app sheet shows me the following error message:
Cannot compare List with Text in (User[Currency] = "$")
I could not fix this error! Is there a way to fix this error?
User[Currency] ="$" is an incorrect syntax. The expression User[Currency] will select a list of all rows of the table for the currency column (Please refer the below help article and screenshot from it) . And then one cannot compare a list with a single text value "$" in this case) That is the precise error , the screenshot is showing.
List expressions - AppSheet Help
Your expression needs to be something like
INDEX(SELECT(User[Currency], [Email]=USEREMAIL()), 1) ="$"
This will dynamically select the user record for the current user based on her/his USEREMAIL()
Couple of more things to note.
1) Instead of always using bulky expressions such as above (INDEX(SELECT(User[Currency], [Email]=USEREMAIL()), 1) ="$") for selecting any column for the logged in user from the User table, you could use the epic "Current User" system tip by @MultiTech referred below.
Current User (Slice) | How to conform your app a... - Google Cloud Community
Then your format rule expression will become
INDEX(Current_User[Currency], 1)="$"
2) Please desist from having expensive expressions in the format rules as they tend to slow down the app. You may want to explore how you can auto select the user's currency in a column while filling up a form etc. You could possibly use "Initial Value" option to pre select the currency of the user and use that column in the format rules.
Another option if you have lot of different currencies..
#1 - The user selects the currency from an Enum column
#2 - Merge the original decimal value and the currency symbol as a text
#3 - Show that column only
#4 - Hide the decimal column itself but use it for other purposes like calculations etc.
User | Count |
---|---|
15 | |
15 | |
8 | |
7 | |
4 |