Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

How to log transactions?

Posted on by

Hi All,

 

I'm looking in to making a way to automatically log every transaction that is made. For example, my app is for inventory management and the device is being checked in and out. This is the screen that updates the transaction table which just tells me which device is checked out to who, but if i recheck out the device to someone else it will just overwrite that data on that table. I'm looking to make a new table with unlimited rows which can me added every time a new transaction is done, How would you recommend to do this?

 

Thanks!

 

Screenshot - 6_16_2017 , 3_21_05 PM.pngCurrent Table which only tells me which Asset is checked out to who.Current Table which only tells me which Asset is checked out to who.

Categories:
  • Brian Dang Profile Picture
    Brian Dang 4,011 on at
    Re: How to log transactions?

    Hi, the formula I wrote would only update a record if there is already one in there; it would check in the device if it is currently checked out--if a record does not have a check in date time (this is the top part of the formula).

     

    In all cases, the formula will always write a new record for the new person checking out the device (second half of the formula after the semicolon). I recommend wrapping it between a condition so that it writes only you want it to.

  • Re: How to log transactions?

    Thanks for your reply mr-dang,

     

    I have a few questions about this method.

     

    Will this add rows for each transaction made? or will it just patch and overwrite the record for the asset?

     

    I am looking to do both actually. One table (the one I showed labled Transactions) specific to the number of assets in this example, I have 16, so as the asset is being checked in and out it will only overwrite the record and always have 16 records, that way it will be easy to see what the status of the asset is. In the second table it will be pretty much the same but it will have unlimted rows, im assuming the way to do this is to add rows for each transaction, that way I can see the history of the transactions.

     

    Which will your method achieve?

     

    Thanks so much!

  • Brian Dang Profile Picture
    Brian Dang 4,011 on at
    Re: How to log transactions?

    Switching to a table with unlimited rows is the right way to go. It's more flexible this way and you have longterm data you could use to analyze which assets are being used more/less frequently/how long.

     

    When Patching a record back to the datasource, I assume you want both of these to occur:

    • Check in the device if it has not been checked in yet
    • Check out the device to the next person

    You'll need some conditions around your Patch formula:

     

    If(!IsEmpty(Filter(TransactionsList,AssetTag=AssetOut.Text && CheckedOutTo=StudentIDOut.Text && InOutStatus="Out")),
     Patch(TransactionsList,First(Filter(TransactionsList,AssetTag=AssetOut.Text && InOutStatus="Out")),
     {CheckedInBy: ,
     CheckInDate: Today(),
     CheckInTime: Now(),
     InOutStatus: "In"
     }
     )
    );
    
    Patch(TransactionsList,Defaults(TransactionsList),
     {AssetTag: AssetOut.Text,
     CheckedOutTo: StudentIDOut.Text,
     CheckOutDate: Today(),
     CheckOutTime: Now(),
     InOutStatus: "Out"
     }
    )

     

    This means, "If there exists a record for the given Asset that is still checked out, then take the first matching record and update it to check it in. Regardless, write a new record to check it out."

     

    If you want to prevent an asset from being checked out until it is formally checked in, you can set the Disable property of a Button to:

    !IsEmpty(Filter(TransactionsList,AssetTag=AssetOut.Text && InOutStatus="Out"))

     

    This means, "Disable this button when the given asset has a record which shows it is currently checked out."

     

    Finally, before you make the switch to a datasource whose purpose is to gather unlimited records, I must caution you that Excel has a 500 record limitation. You will be able to write more than 500 records, but only the first 500 will ever be read by PowerApps in its current form. If you need a more robust datasource, I recommend the Common Data Service.

  • How to log transactions?

     

     

    Hi All,

     

    I'm looking in to making a way to automatically log every transaction that is made. For example, my app is for inventory management and seprate devices are being checked in and out. This is the screen that updates the transaction table which just tells me which device is checked out to who, but if i recheck out the device to someone else it will just overwrite that data on that table. I'm looking to make a new table with unlimited rows which can be added every time a new transaction is done, How would you recommend to do this?

     

    Thanks!

    Screenshot - 6_16_2017 , 3_21_05 PM.pngCurrent Table which only tells me which Asset is checked out to who.Current Table which only tells me which Asset is checked out to who.

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

October 2024 Newsletter…

October 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #4 How to Conntact Support…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 142,733

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,750

Leaderboard