I have an app that allows users to update an inventory list of cabling. When the user submits the changes, they are supposed to appear on a table in an Excel spreadsheet. When the user only changes 1 item, it adds it perfectly to the sheet. However, if they adjust multiple items, it doesn't put anything into the table. Not sure why that is. Screenshots are below.
**2 items selected
**Take button code
Set(_Checked, CountRows(Filter(Gallery2.AllItems,Checkbox2.Value=true))) ;
If(_Checked>0,Set(_popup,true),Notify("Please select one or more options.")) ;
Set(_takePressed,true)
**Pop up window with checked items
**Pop up window gallery (Gallery7) code; pulling from main gallery (Gallery2)
ForAll(
Filter(Gallery2.AllItems,Checkbox2.Value) As _item,
{ID: _item.ID,
Length: _item.Length,
Color: _item.Color,
Quantity: _item.Quantity,
'Item Name':_item.Name
}
)
**Update button code
Patch('Inventory Tracking - TESTING',
ForAll(
Filter(Gallery7.AllItems, !IsBlank(TextInput2_3.Text)) As _item,
{ID: _item.ID,
Quantity: _item.Quantity + (Value(_item.TextInput2_3.Text) * If(_addPressed,1,-1))
}
)
)
;
Collect(InventoryUsed,
ForAll(Filter(Gallery7.AllItems, !IsBlank(TextInput2_3.Text)) As _item2,
{'Product Name':_item2.'Item Name',
Color:_item2.Color.Value,
Length:_item2.Length.Value,
Quantity:_item2.TextInput2_3.Text}
));
Set(_addPressed,false);
Set(_takePressed,false);
Set(_popup,false);
Set(isChecked,false);
Set(isChecked,true)
This does not work as intended as it doesn't put those values into the Excel sheet. Any thoughts would be extremely helpful!
Solved! Go to Solution.
Hmmm...that is strange! I am wondering if this is a limitation with the Excel connector. I don't work enough with the Excel connector to have discovered all of its little quirks.
Let's try another approach:
With({_items: Filter(Gallery7.AllItems, !IsBlank(TextInput2_3.Text)) },
Patch('Inventory Tracking - TESTING',
ForAll(_items As _item,
{ID: _item.ID,
Quantity: _item.Quantity + (Value(_item.TextInput2_3.Text) * If(_addPressed,1,-1))
}
)
);
Patch(InventoryUsed,
ForAll(_items As _item2,
Patch(Defaults(InventoryUsed),
{'Product Name':_item2.'Item Name',
Color:_item2.Color.Value,
Length:_item2.Length.Value,
Quantity:_item2.TextInput2_3.Text}
)
)
)
);
Set(_addPressed,false);
Set(_takePressed,false);
Set(_popup,false);
Set(isChecked,false);
Set(isChecked,true)
Let's see if that makes any difference.
Are you getting all the selected items in your SharePoint list? Or does it happen to both the list and the Excel?
Let's make a slight change (in case if you referential formulas are getting adjusted with the first Patch):
With({_items: Filter(Gallery7.AllItems, !IsBlank(TextInput2_3.Text)) },
Patch('Inventory Tracking - TESTING',
ForAll(_items As _item,
{ID: _item.ID,
Quantity: _item.Quantity + (Value(_item.TextInput2_3.Text) * If(_addPressed,1,-1))
}
)
);
Collect(InventoryUsed,
ForAll(_items As _item2,
{'Product Name':_item2.'Item Name',
Color:_item2.Color.Value,
Length:_item2.Length.Value,
Quantity:_item2.TextInput2_3.Text}
)
)
);
Set(_addPressed,false);
Set(_takePressed,false);
Set(_popup,false);
Set(isChecked,false);
Set(isChecked,true)
I didn't have any errors with this new code, but it still isn't updating the spreadsheet when more than 1 item is checked and updated. It updates when 1 item is in Gallery7, but not when there are multiple.
Hmmm...that is strange! I am wondering if this is a limitation with the Excel connector. I don't work enough with the Excel connector to have discovered all of its little quirks.
Let's try another approach:
With({_items: Filter(Gallery7.AllItems, !IsBlank(TextInput2_3.Text)) },
Patch('Inventory Tracking - TESTING',
ForAll(_items As _item,
{ID: _item.ID,
Quantity: _item.Quantity + (Value(_item.TextInput2_3.Text) * If(_addPressed,1,-1))
}
)
);
Patch(InventoryUsed,
ForAll(_items As _item2,
Patch(Defaults(InventoryUsed),
{'Product Name':_item2.'Item Name',
Color:_item2.Color.Value,
Length:_item2.Length.Value,
Quantity:_item2.TextInput2_3.Text}
)
)
)
);
Set(_addPressed,false);
Set(_takePressed,false);
Set(_popup,false);
Set(isChecked,false);
Set(isChecked,true)
Let's see if that makes any difference.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
192 | |
67 | |
46 | |
41 | |
22 |
User | Count |
---|---|
251 | |
122 | |
83 | |
80 | |
68 |