cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
AGS94
Level 8

Using LookUp with UpdateIf

Right now I have cobbled together the following solution that is working fine.

 

I have the following UpdateIf in the OnChange property of a dropdown (DrpPrdTyp😞

UpdateIf(CollPtAPrd,Type=LblProdTypeLookup.Text,{GrpPrd:Value(1)},Type=LblProdTypeLookup.Text,{GrpPrd:Value("")})

which references (via LblProdTypeLookup.Text) the following LookUp formula (within the Text property of a Label):

LookUp(Type,DrpPrdTyp.Selected.Value=GenType).TypeType

I was hoping I could simply replace each instance of LblProdTypeLookup.Text in the DropDown formula with the entire LookUp formula above. When I try I get an "Invalid argument type" error. As a result I am having to hide the Label so I can reference it in order to make the UpdateIf work. Very clunky solution. What am I missing?

 

 

5 REPLIES 5
shailendra74
Level 10

Re: Using LookUp with UpdateIf

Hi @AGS94 

 

What is the datatype of "Type" in CollPtAPrd.  I think it refers to a lookup field. If so you might need the criteria as 

 

Type.Value = LblProdTypeLookup.Text

 

Thanks.

Community Support Team
Community Support Team

Re: Using LookUp with UpdateIf

Hi @AGS94 ,

Since the result of this formula is a column:

LookUp(Type,DrpPrdTyp.Selected.Value=GenType).TypeType

 While LblProdTypeLookup.Text respresents a value.

So I suggest you try this formula:
LookUp(Type,DrpPrdTyp.Selected.Value=GenType,TypeType)       (this formula will return a value)

Then, replace LblProdTypeLookup.Text with this LookUp formula in your UpdateIf formula.

Here's a doc about LookUp function for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

 

 

 

Best regards,

Community Support Team _ Phoebe Liu

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AGS94
Level 8

Re: Using LookUp with UpdateIf

CollPtAPrd is a collection and the data within the columns I am working with are strings.

 

I am trying to get rid of LblProdTypeLookup.Text  altogether and essentially nest my LookUp within the UpdateIf. My apologies if I am missing something?

AGS94
Level 8

Re: Using LookUp with UpdateIf

Thanks Phoebe. If I undertsand correctly, you are recommending the following?

 

UpdateIf(CollPtAPrd,Type=LookUp(Type,DrpPrdTyp.Selected.Value=GenType,TypeType),{GrpPrd:Value(1)},Type=LookUp(Type,DrpPrdTyp.Selected.Value=GenType,TypeType),{GrpPrd:Value("")})

If so, I am still getting the "Invalid argumant type".

 

Did I do this right?

Community Support Team
Community Support Team

Re: Using LookUp with UpdateIf

Hi @AGS94 ,

Could you describe more clearly about your two conditions?

According to your formula, you use the same formula in the two conditions:

Type=LookUp(Type,DrpPrdTyp.Selected.Value=GenType,TypeType)

Could you tell me the data type of: Type, TypeType,GrpPrd?

Could you show me your settings of the DrpPrdTyp? Are you sure it's drop down not combo box?

Try this :

UpdateIf(CollPtAPrd,Type=LookUp(Type,DrpPrdTyp.Selected.Value=GenType,TypeType),{GrpPrd:1},
condition2,{GrpPrd:""}) //replace condition2 with your second condition

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 347 members 6,851 guests
Recent signins:
Please welcome our newest community members: