# Data Validation

**URL:** <https://forum.adalo.com/t/data-validation/12723>\
**Category:** Database\
**Created:** [May 19, 2021, 6:59am UTC](https://forum.adalo.com/t/data-validation/12723 "2021-05-19T06:59:24Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![gani02](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@gani02](https://forum.adalo.com/u/gani02)\
**Post date:** [May 19, 2021, 6:59am UTC](https://forum.adalo.com/t/data-validation/12723/1 "2021-05-19T06:59:24Z")

</div>

Hi,

I am building an expense tracking app… The transaction database contains all, you guessed it, the transactions (both credit and debit). The key thing to note is this database contains transactions for all users. I do not want to allow users to add a debit transaction that would take the balance to negative. As there is no form validation and no way to group the database records by customer ID, I am kind of in a limbo. I am 90%. there to publish the app and this is becoming a showstopper.

Any advise on how to handle this?

Note: Hope Adalo puts the Series A $8MM funding into good use to enable most sought after features.

---

<div class="post-metadata">

**Author:** ![bhanu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/bhanu/32/6859_2.png) [@bhanu](https://forum.adalo.com/u/bhanu)\
**Post date:** [May 19, 2021, 7:14am UTC](https://forum.adalo.com/t/data-validation/12723/2 "2021-05-19T07:14:00Z")

</div>

This is very much possible to do, you need to setup relationship between transactions and user collections (many to one), this will restrict users from seeing each other’s information/transactions.

---

<div class="post-metadata">

**Author:** ![gani02](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@gani02](https://forum.adalo.com/u/gani02)\
**Post date:** [May 19, 2021, 7:36am UTC](https://forum.adalo.com/t/data-validation/12723/3 "2021-05-19T07:36:50Z")

</div>

Thank you Bhanu for the quick response. One problem I have is the admin logs in and creates/updates transactions for multiple users (More like an admin managing multiple employee expenses). Eventually employees will have their own app with only their view and what you suggested would work wonderfully for that.

Any help would be deeply appreciated.

---

<div class="post-metadata">

**Author:** ![bhanu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/bhanu/32/6859_2.png) [@bhanu](https://forum.adalo.com/u/bhanu)\
**Post date:** [May 19, 2021, 7:41am UTC](https://forum.adalo.com/t/data-validation/12723/4 "2021-05-19T07:41:37Z")

</div>

When the admin performs action, you can provide additional step to select staff name that expense belongs to and update the table accordingly and an additional column to indicate who updated the record for audit purpose.

---

<div class="post-metadata">

**Author:** ![gani02](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@gani02](https://forum.adalo.com/u/gani02)\
**Post date:** [May 19, 2021, 7:50am UTC](https://forum.adalo.com/t/data-validation/12723/5 "2021-05-19T07:50:38Z")

</div>

This is what I have so far.

Transactions table with four columns (few other columns for audit purposes but will not impact the functionality). I have the user column as there are multiple admins managing different departments and this is linked to the logged in user.

Employee\_name, Amount, Type, User  
Employee 1 $5000. Credit. Admin 1  
Employee 1 $2000. Credit. Admin 1  
Employee 2. $9000. Credit. Admin 1  
Employee 1 $3000. Debit. Admin 1  
Employee 1. $5000. Debit. Admin 1 - This transaction shouldn’t be allowed as the “Employee 1” balance will go negative.

I have two screens, one each for entering credit and debit.

What am I missing here?

---

<div class="post-metadata">

**Author:** ![bhanu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/bhanu/32/6859_2.png) [@bhanu](https://forum.adalo.com/u/bhanu)\
**Post date:** [May 19, 2021, 8:05am UTC](https://forum.adalo.com/t/data-validation/12723/6 "2021-05-19T08:05:53Z")

</div>

I believe you’re updating this table and populating the user with the person doing the changes in App. In this case you need to split the flow between Admin & Actual user.

When admin performs action - the table should be updated with the first 3 fields and for the 4th field admin should have a dropdown with list of staff to select from and update the db with that user.

when the user performs action - the 4th field in the above step should be defaulted to the current user.

---

<div class="post-metadata">

**Author:** ![gani02](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@gani02](https://forum.adalo.com/u/gani02)\
**Post date:** [May 19, 2021, 8:14am UTC](https://forum.adalo.com/t/data-validation/12723/7 "2021-05-19T08:14:28Z")

</div>

The employee doesn’t even hav a log in the current setup. There is only 1 user and that is “Admin 1”

---

<div class="post-metadata">

**Author:** ![bhanu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/bhanu/32/6859_2.png) [@bhanu](https://forum.adalo.com/u/bhanu)\
**Post date:** [May 19, 2021, 8:33am UTC](https://forum.adalo.com/t/data-validation/12723/8 "2021-05-19T08:33:49Z")

</div>

Does the users have access to the app to see their information? If no, where do they see others data?

And coming to -ve data, you need to check first whether the balance becomes negative by using the conditional action before performing the action.

i.e. Do this only when the debit transaction amount is less than the available balance. This will stop from proceeding with action

---

<div class="post-metadata">

**Author:** ![gani02](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@gani02](https://forum.adalo.com/u/gani02)\
**Post date:** [May 19, 2021, 9:42am UTC](https://forum.adalo.com/t/data-validation/12723/9 "2021-05-19T09:42:10Z")

</div>

I am building only admin app and the users (Employees) will have their own app. Not in scope for current project.

You are correct. I should check before adding the -ve data. I am just not sure how to go about it in Adalo.

---

<div class="post-metadata">

**Author:** ![bhanu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/bhanu/32/6859_2.png) [@bhanu](https://forum.adalo.com/u/bhanu)\
**Post date:** [May 19, 2021, 9:51am UTC](https://forum.adalo.com/t/data-validation/12723/10 "2021-05-19T09:51:26Z")

</div>

When you’re performing the action, click on **Show advanced** at the bottom and choose “Sometimes” and then add your condition below in “This action will only happen if” …

 ![image](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/5/5b7632f6a4644fdfb56408eae79539c2abecf1ac.png)
