Hello,
I build an app where in the settings, it’s possible to use a percentage. Then I use this percentage in calculations in the app.
For example: Company X, 5% rate.
When the user creates the company, it’s fairly simple. The user input 5 and then I divided it by 100 to save it in the database.
However, if the user decided to edit that value in the future, it’s where I don’t know how to do.
I have an update company screen - however the value showed for that rate is 0.05 and not 5.
This means that the person should input 0.04 if they want to change it to 4% and I simply input that value in the database - this is not very user friendly.
I would like the person to be able to input 4 and I divide it by 100. However, the issue here is that if the person simply click on SAVE without changing the value, then the software take the original value of 0.05 and divided it again by 100 making it 0.0005. Which is not good.
How to make this simple for the user.
In my case, the company has three different rates.
Thank you for your help.
So if I understand when a user add a 5 in your input the action button is INPUT VALUE/100 ?
What you need to do is on your Edit screen and the input (where you show the value rate) use a formula for default value (Current company rate*100) and when he want to edit it use the same action described on top.
If it’s dont work can you please send us some screenshot of your database structure and your button action please
Thank you for the reply.
In the first screen during the creation of the company, the user input the rates such as 5 for 5%. When submiting, the application divide by 100 see screenshots:
That is perfect.
However when the user comes back (let’s say the week after) and he needs to change the rate from 5% to 4%.
the user sees the following:
and here the view in Adalo:
As I understand, I can only show the data stored in Adalo. I have no way to tell the software, don’t show 0.05 but show 0.05 * 100
So in that case the user has to use like 0.05 instead of 5% because then I save simply in the database as such:
Do I understand you correctly, there is a way to tell Adalo,
a) if the user change the input, do the input divided by 100
b) if the user didn’t change the input, don’t touch that input
?
In conclusion there are two things I cannot do which are linked:
a) Show in the form the data multiplied by 100 and not simply the data stored in the database.
b) If the user modify one data in the form, update only that data and divide it by 100
Thank you so much for your support.
Je vois que nous parlons tous les 2 le français, ça va être plus facile.
Je vais tester demain matin de refaire ton app et regarde de plus pres.
Je me demande juste à quoi te sert tout cela, car à mon avis il pourrait être plus simple de stocker dans la base de donné 5 au lieu de 0,05 et lorsque tu devras l’afficher dans un text tu utiliseras une formule ( Current rate/ 100 ) mais dans ta base de donné ce sera noté 5 et l’utilisateur verra 5 au lieu de 0,05.
Ainsi également, lorsque ton utilisateur voudra modifier il verras s’afficher 5, et pourra tout simplement modifier par un 4. Étant donné que la division ne s’opère pas à ce moment là, aucun problème à ce niveau
Cependant faudra pas oublier d’utiliser une formule à chaque fois que tu voudras afficher 0,05 ( sauf dans un input )
Et dans Adalo lorsque tu utilise Magic Text sur un nombre tu peux cliquer dessus et modifier la ‘struscture’ en ajoutant par exemple une devise, un signe avant ou après le nombre.
Désolé si c’est un peu brouillon Pour résumer, dans la base de donné tu enregistre le chiffre 5 sans aucune division. La division tu devras la faire lorsque tu souhaite afficher le pourcentage ( 0,05% ) en utilisant la Formule
What you can do, which I did in several apps, is a collection that says discounts
A text property that says 5%, 10%, 15% and a number property that says 5,10,15
So that the user selects the percentage through a discount dropdown (he will only be able to see the text)
In the user database put a Text property that says discount and a Number property that says percentage
When he selects the discount he wants, you update the user and save the percentage he chose and the number
every time the update is modified
For example: if you earn 10% for each order, the mathematical formula would be like this
the sum of the total paid for orders * user discount / 100
Thank you @devrimdmk.
How do you do that part? If I open my form input, I only have the following options:
I don’t see a place where I could define - “current company rate * 100”
I’m using the stardard form - is that the issue?
Thank you for your support