Hello everybody,
I’m building an app using Power Apps Studio, which is connected to a Microsoft List. The app was auto-generated, and I’ve made some modifications.
I’m trying to create a formula that allows me to update the quantity (Kolicina) of a specific item in the list based on an ID entered by the user. However, I keep running into issues, and I’d appreciate your help.
Here’s what I want to achieve:
- A user enters an
ID and a quantity to subtract.
- The app finds the item with the corresponding
ID in the list.
- The app reduces the
Kolicina field for that item by the entered quantity.
Here’s my formula:
Patch(
Offcut,
LookUp(Offcut, Ident = Value(Ident_DataCard2_1.Default)), // Find the item by ID
{ Kolicina: Kolicina - Value(Kolicina_DataCard2_1.Default) } // Update the quantity
)
Issues I’m facing:
- I sometimes get an error saying, "Incompatible types for comparison: text, number".
- Other times, I get an error like, "Invalid use of Text property", even though the controls seem to have the correct values.
Additional Details:
Offcut is the name of the list.
Ident is a column in the list (it’s supposed to be numeric).
Kolicina is a numeric column that stores the quantity.
Ident_DataCard2_1.Default is the user input for the ID.
Kolicina_DataCard2_1.Default is the user input for the quantity to subtract.
What I’ve tried:
- Ensuring that
Ident is numeric by using Value().
- Using labels to display the values of
Ident_DataCard2_1.Default and Kolicina_DataCard2_1.Default to debug.
- Changing
LookUp to directly match Ident without Value().
Questions:
- Is my formula structured correctly?
- How can I ensure compatibility between text and number types when comparing or updating values?
- Are there any debugging tips I can use to pinpoint where the issue is?
Any guidance would be greatly appreciated! 😊
Thank you in advance!