cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

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
Highlighted
Anonymous
Not applicable

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.

Highlighted
Community Support
Community Support

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.
Highlighted
Resolver I
Resolver I

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?

Highlighted
Resolver I
Resolver I

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?

Highlighted
Community Support
Community Support

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
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,760)