web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Addition and Subtract ...
Power Apps
Unanswered

Addition and Subtract balance in Gallery

(0) ShareShare
ReportReport
Posted on by 438

Hello, I'm trying to find a way to perform addition and subtraction using functions.

 

Before, my name was 'Dylan Davis,' and I had a balance of '0' in the list.

Screenshot 2023-11-04 132708.png

When staff or teachers fill out the form and submit it, students can view the transaction history to see where teachers or staff have received deposits or withdrawn Dragon Tickets.

Screenshot 2023-11-04 132132.png

 

After submitted, the deposit or withdrawn should be updated to numbers for students and displayed as number on the screen, it is connected to the SharePoint list 'DHS Student Users'. Addition is indicated by a plus sign (+) for DESPOSIT, while subtraction is represented by a minus sign (-) for WITHDRAWN. Where's $45??

Screenshot 2023-11-04 132708.png

 

Last thing, regarding my transaction history: How can I look up if the User().Full name matches and display a list, which may contain more than one entry?

Screenshot 2023-11-04 134744.png

Categories:
I have the same question (0)
  • cdwhite Profile Picture
    1,067 Most Valuable Professional on at

    Hi @dylandavis09 ,

    If I understand correctly, when the line is added to the PBiS Transaction History list, it needs to update the entry for the relevant student in the DHS Students Users list? If so, would that mean you'll need to sum up ALL transactions for one student? For example, Dylan could have multiple transactions at $45, so would there need to be an overall total that needs updating?

     

    In terms of your query around User().FullName - you're correct, this won't be unique as multiple people could have the same name. In Active Directory & Exchange, this is bypassed by the users email address, as this will ALWAYS be unique to the individual user. You can access this with User().Email, though I'd always recommend the Office 365 Users approach personally.
    ------------------------------------------------------------------------------------------------------------------------------
    If I've answered your question, please mark your post as Solved. You can accept more than one post as a solution.

    If my response was a good one, please give it a Thumbs Up!

    Visit my blog: https://platformsofpower.net

  • dylandavis09 Profile Picture
    438 on at

    @cdwhite, thank you for understanding what I want to achieve. Let me explain. You are correct: when a new line is added to the PBiS Transaction History, we need to sum up all transactions for one student and then send the updated totals to the DHS Student Users. For example, if a teacher makes a $45 deposit and later another $100 deposit, there should be an overall total that needs to be updated in the list based on the matching full name.

     

    How it makes if deposit (sum), and withdrawn (subtract).

     

    PBiS Transaction History:

    Dylan Davis              $45            Deposit

    Dylan Davis              $100          Deposit

     

    Need to update the DHS Student Users:

    Dylan Davis              $145

  • Verified answer
    cdwhite Profile Picture
    1,067 Most Valuable Professional on at

    Hi @dylandavis09 ,

    Ok, this is what I've done at my end, works ok at the moment but may need something better.

    I've added a text input box to add values, called txtValue. I've also got a dropdown box called dpdChoice that has Deposit & Withdrawn as the two options. I've also added a user email & ID column for unique identifiers as more than one person could have the same name.


    I have a button that, when clicked, will:
    a) add a new transaction to the Transactions list

    b) update the D-Tickets value for the relevant user

    So adding the transaction:

    // Determine whether value will be a positive or negative amount
    With(
     {
     tvValue: If(
     dpdChoice.Selected.Value = "Deposit",
     Value(txtValue.Text),
     Value(txtValue.Text) * -1
     )
     },
    // Create new entry in Transactions list 
     Patch(
     'Transaction History',
     Defaults('Transaction History'),
     {
     Title: "Dylan Davis",
     Email: "dylan.davis@email.com",
     UserID: 1,
     Deposit: Value(tvValue),
     'Deposit Type': dpdChoice.Selected.Value
     }
     )
    );


    Then, updating the D-Tickets value for the relevant user. I'm using the List ID of the person for a one-to-one match:

    // Sum all of users transactions
    With(
     {
     tvSum: Sum(
     Filter(
     'Transaction History',
     UserID = 1
     ),
     Deposit
     )
     },
    // Update users D-Tickets total 
     Patch(
     'DHS Student Users',
     {ID: 1},
     {'D-Tickets': tvSum}
     )
    )

    I've tested at my end and works ok, though may need a better solution that avoids delegation:

    cdwhite_0-1699221556580.png


    ------------------------------------------------------------------------------------------------------------------------------
    If I've answered your question, please mark your post as Solved. You can accept more than one post as a solution.

    If my response was a good one, please give it a Thumbs Up!

    Visit my blog: https://platformsofpower.net

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard