cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
likhith117
Helper I
Helper I

Perform two lookups for same patch

 Need help in updating master list

hi 

I performed a patch to update Issue qty in master list with this code.

 

Patch(
Consumable_Master,
LookUp(
Consumable_Master,
Value(Dropdown1.Selected.'Item Code') = Value('Item Code')
),
{'Issue Qty': Value(DataCardValue6.Text) + Value(Dropdown1.Selected.'Issue Qty')}
);

problem is

Now I need to update on two criteria.one is lookup performed in the formula.

and another is Type (choice data type) =Issue.

If Type = Purchase it should update PURCHASE qty in master list.

please help in devolping the formula.

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

Hi @likhith117 ,

 

Could you please share more details about your scenario? Would you like to update different column's value base on the Type column which is a Choice column?

 

If so, please try below formula:

 

Switch(
   Type.Value,
   "Purchase",
   Patch(
         Consumable_Master,
         LookUp(
         Consumable_Master,
         Value(Dropdown1.Selected.'Item Code') = Value('Item Code')
         ),
        {
         'Purchase Qty': ...)
        }
   ),
   "Issue",
   Patch(
         Consumable_Master,
         LookUp(
                Consumable_Master,
                Value(Dropdown1.Selected.'Item Code') = Value('Item Code')
         ),
         {
          'Issue Qty': Value(DataCardValue6.Text) + Value(Dropdown1.Selected.'Issue Qty')
         }
   )
);

 

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

3 REPLIES 3
v-jefferni
Community Support
Community Support

Hi @likhith117 ,

 

Could you please share more details about your scenario? Would you like to update different column's value base on the Type column which is a Choice column?

 

If so, please try below formula:

 

Switch(
   Type.Value,
   "Purchase",
   Patch(
         Consumable_Master,
         LookUp(
         Consumable_Master,
         Value(Dropdown1.Selected.'Item Code') = Value('Item Code')
         ),
        {
         'Purchase Qty': ...)
        }
   ),
   "Issue",
   Patch(
         Consumable_Master,
         LookUp(
                Consumable_Master,
                Value(Dropdown1.Selected.'Item Code') = Value('Item Code')
         ),
         {
          'Issue Qty': Value(DataCardValue6.Text) + Value(Dropdown1.Selected.'Issue Qty')
         }
   )
);

 

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

Hey @v-jefferni Thanks for the help its working.

 

One problem is The submit button contains two functions Patch and submit form.

If for example Someone didn't give any thing in required fields and click submit.The patch function updating the list but form not submitting.It becomes a problem in this case. please figure out a formula for this (Iferror kind of ones I expect)

Hi @likhith117 ,

 

Type selecting is a Combo box? If so, you will need:

TypeCombobox.Selected.Value

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (4,110)