Hello Everyone,
I'm new to PowerApps and have a form linked to a Sharepoint List.
I'm patching some data to a sharepoint list, and while I'm doing it, I'd want to see whether the combobox has a chosen item or if it's empty, and then I'd like to update the data in the sharepoint List column.
I can only complete the part when the Combobox is set to Data. However, I am unable to obtain the desired outcome if the combobox data is left blank. If somebody could assist me in this circumstance, it would be greatly appreciated.
If(
IsBlank(ComboBox2.Selected),
{'Column Name': "Data not present"},
{'Column Name': "Data Present"}
)
PATCH CODE :
ForAll(ComboBox1.SelectedItems As ColCollection,ForAll(ComboBox2.SelectedItems As B,ForAll(ComboBox3.SelectedItems As C,
Patch(PowerAppList,
Defaults(PowerAppList),
{Title: "Mr"},
{abc: Name.Text},
{Country: ColCollection.COMPANY},
{System: B.SYSTEM},
{'App Requested': C.'App requested'},
If(
IsBlank(ComboBox2.Selected),
{'A': "Data not present"},
{'B': "Data Present"}
)
)
)
)
);
ForAll(
ComboBox1.SelectedItems As A,
ForAll(
ComboBox2.SelectedItems As B,
ForAll(
ComboBox3.SelectedItems As C,
If(
IsBlank(ComboBox2.Selected),
Patch(
PowerAppList,
Defaults(PowerAppList),
{Title: "Mr"},
{abc: Name.Text},
{Country: A.COMPANY},
{'App Requested': C.'App requested'},
{'Last name': "Data not Present"}
),
Patch(
PowerAppList,
Defaults(PowerAppList),
{Title: "Mr"},
{abc: Name.Text},
{Country: A.COMPANY},
{System: B.SYSTEM},
{'App Requested': C.'App requested'},
{'Last name': "Data Present"}
)
);
)
)
);
Hello @Shaheer I tried this approach as well but with this approach it didn't patch any data to Sharepoint List and none of the entries are filled with data
Try using ComboBox2.SelectedItems instead of ComboBox2.Selected. Also, since you are using ForAll for ComboBox2, you need to check if all selected items are blank. Here's an updated version of your code:
ForAll(
ComboBox1.SelectedItems As ColCollection,
ForAll(
ComboBox2.SelectedItems As B,
ForAll(
ComboBox3.SelectedItems As C,
Patch(
PowerAppList,
Defaults(PowerAppList),
{Title: "Mr"},
{abc: Name.Text},
{Country: ColCollection.COMPANY},
{System: B.SYSTEM},
{'App Requested': C.'App requested'},
If(
IsBlank(ComboBox2.SelectedItems),
{'A': "Data not present"},
{'B': "Data Present"}
)
)
)
)
)
This change should check if all selected items in ComboBox2 are blank and then handle the PATCH accordingly. Give it a try, and let me know if it works for you!