Hello,
Having a bit of an issue figuring out what I am missing here. This is a custom SharePoint form that has multiple pages and forms, so I am using the SharePointIntegration object for New, Edit, View, etc. I have two galleries on a screen. One is a list of equipment (cameras, mouse, keyboard, etc.) that is being pulled from a SharePoint list as the data source. I have another gallery that is a collection that is created when you click on the add icon. When the add icon is clicked, it will appear in the selected equipment gallery. Simple so far.
When an item is added to the collection
Collect(OpEquip,{Product:ThisItem.'Product Description',Code:ThisItem.'Product Code'})
the add button should become disabled. If you remove it from the selected equipment, then the add button/icon really, will become active/edit again. I have this working for a New form by adding this to the DisplayMode of the add icon
If(Label13.Text in OpEquip.Code,DisplayMode.Disabled,DisplayMode.Edit)
Label13 is the 'Product Code' from the list and is added to the collection in the column 'Code'.
OnNew, this works perfectly. I click the add icon, it is added to the collection and appears in the gallery. I click on the trash can icon and the item is removed from the gallery/collection and the add icon is active again. The issue is when you edit. When I come in to edit. I am handling repopulating the collection with the OnVisible property on the screen. I am pulling a stored value from another list that is a string in another list "code | code | code". Here is the function I use.
Clear(OpEquip);
Refresh('New Hire Purchase Requests');
ClearCollect(
EquipCode,
Split(
DataCardValueOptionalEquipCode.Text,
"|"
)
);
ClearCollect(
Equip,
Split(
DataCardValueOptionalEquip.Text,
"|"
)
);
ForAll(
Sequence(CountRows(EquipCode)),
Collect(
OpEquip,
{
Code: Last(
FirstN(
EquipCode,
Value
)
).Value,
Product: Last(
FirstN(
Equip,
Value
)
).Value
}
)
);
When I put the form in edit mode and go to that screen, the collection is getting populated and the items appear in the selected equipment gallery. However, the add icons are not disabled allowing you to add duplicate values. I assumed that the function I put on the display property of the icon would be enough, but it does not work. I tried putting that code, and various other variations, on the OnVisible property of the screen and the OnEdit property of the SharePointIntegration object, but it still did not work. Any help would be appreciated. Thanks

Report
All responses (
Answers (