cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

Flow to update Inventory List when Ledger Transaction added

Hey everyone,

I'm working on an inventory control system for my nonprofit, and I've run into a snag.  I built two lists, 'Warehouse Inventory Control List' and 'Warehouse Inventory Transaction Ledger'.  I created a PowerApp that can create new items for the Inventory list, and create ledger entries when items are removed from the warehouse.

The problem I've run into is that I want to ensure the inventory update (i.e. changes to the WICL) applies from the Transaction Ledger list trigger, rather than the PowerApp.  The reason for this is I also want to update the Inventory list if entries are modified or deleted, which would be done through SharePoint directly by an admin.

In my Flow, I have the following steps:

1. Trigger occurs - New item added to Transaction Ledger.

2. Get Item - Retrieves the Item from the Inventory list corresponding to the Transaction Ledger (works).

3. Subtract Quantity taken from Quantity on Hand - Doesn't work.

                    - I have tried two methods for this step.  First, I created Integer variables from each list's quantity value, then tried to add them together.  I was told the integers weren't valid integers.  Then, I tried to use Compose to create an output from the two quantity values - the Integers are being pulled into Power Automate as Floats, and sub() won't work.

4. Add Quantity Taken to Quantity Used to Date - Same problem as #3, only with add() this time.

5. Update item - this should work if I can get variables into the fields I need them.  I wish I could just add two values in the field and be done with it.

 

I can provide more info tomorrow if necessary, and I appreciate any help in advance.  I feel like I'm losing my mind trying to convert floats to ints.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User II
Super User II

Hi @ParkCenterDev 

 

Can you show me the Power Automate itself and the error. It's easier to check it that way.

 

Have you tried the int function?

int(<variable>)

 

It needs to be a string but you can get one easily with the string function.

int(string(<Variable>))

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

4 REPLIES 4
Super User II
Super User II

Hi @ParkCenterDev 

 

Can you show me the Power Automate itself and the error. It's easier to check it that way.

 

Have you tried the int function?

int(<variable>)

 

It needs to be a string but you can get one easily with the string function.

int(string(<Variable>))

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

ParkCenterDev_0-1597425229618.pngParkCenterDev_1-1597425241986.png

Above are the lists in SharePoint.  With a compose action, I have attempted the following three methods:

sub(item()?['Quantity On Hand'],triggerBody()?['Quantity'])

        - this returns an error because both values are Floats.

sub(int(item()?['Quantity On Hand']),int(triggerBody()?['Quantity']))

        - Also returns an error - The value cannot be converted to the target type.

sub(int(string(item()?['Quantity On Hand'])),int(string(triggerBody()?['Quantity'])))

      - Same error as above.

 

 

ParkCenterDev_0-1597425534395.png

 

So I ended up taking a few days to think about things and realized you had given me the solution, I just needed to rearrange things first.  Thank you!

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (25,554)