Hi,
I have this logic:
I get value in ComboBox using defaultsiselecteditem from SP list 2, and Item using ["aaaa", "bbbb", "cccc"].
I want if:
1. Value from SP list 2 already exists in ComboBox, then just update the data
2. I just add new value in combobox with that item, then patch new data
3. if combobox still blank, then just dont patch/update
I used this formula, not error but cant work.
Formula:
ForAll(
UpdateDocument_1.AllItems,
If(
IsBlank(
First(
Filter(
'PE Workload',
'Job Description' = JobDesc_Update.Text
)
).'Task (Task0)'
),
// If 'Task (Task0)' is blank, then patch data
Patch(
'PE Workload',
Defaults('PE Workload'),// You may need to adjust this based on your list structure
{
'Job Description': JobDesc_Update.Text,
'Task (Task0)': Task_2.Text,
PIC: Text(PIC_PE_2.Selected.Value),
Title: ProductID_Update.Text,
Customer: Customer_Update.Text,
'% Progress': 0
// Add other fields as needed
}
),
// If 'Task (Task0)' is not blank, then update data
UpdateIf(
'PE Workload',
'Job Description' = JobDesc_Update.Text && 'Task (Task0)' = Task_2.Text,
{
PIC: Text(PIC_PE_2.Selected.Value)
// Add other fields as needed
}
)
)
)
How to do it? Thank you!!!
Hi @Rajkumar_404 ,
I try that formula but cant work, so I modify, and I got this formula:
ForAll( UpdateDocument_1.AllItems,
If(IsBlank(PIC_PE_2.Selected.Value),
{},
If(LookUp('PE Workload','Job Description' = JobDesc_Update.Text,'Task (Task0)') = Task_2.Text,
UpdateIf('PE Workload','Job Description' = JobDesc_Update.Text && 'Task (Task0)' = Task_2.Text,{'Task (Task0)': Task_2.Text,PIC: Text(PIC_PE_2.Selected.Value)}),
Patch('PE Workload',Defaults('PE Workload'),{'Job Description': JobDesc_Update.Text,'Task (Task0)': Task_2.Text,PIC: Text(PIC_PE_2.Selected.Value),Title: ProductID_Update.Text,Customer: Customer_Update.Text,'% Progress': 0}))))
I can update data, I can skip update/patch the data if combobox blank, but for patch function, It will patch all data again which combobox not blank. So there are double data. Do you know how to fix it? Thankyou!
Hi @firda59
Try this formula,
If(
IsBlank(ComboBox1.Selected.Value), /* If ComboBox is blank, do nothing */,
If(
IsEmpty(
Filter(
'PE Workload',
'Job Description' = JobDesc_Update.Text && 'Task (Task0)' = Task_2.Text)), /* If Task (Task0) is not found, patch new data */
Patch(
'PE Workload', Defaults('PE Workload'),
{
'Job Description': JobDesc_Update.Text,
'Task (Task0)': Task_2.Text,
PIC: Text(PIC_PE_2.Selected.Value),
Title: ProductID_Update.Text,
Customer: Customer_Update.Text,
'% Progress': 0 /* Add other fields as needed */
} ), /* If Task (Task0) is found, update data */
UpdateIf(
'PE Workload',
'Job Description' = JobDesc_Update.Text &&
'Task (Task0)' = Task_2.Text,
{
PIC: Text(PIC_PE_2.Selected.Value) /* Add other fields as needed */ } )
)
)
Thanks!
If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.