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

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 8

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: Powered On

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: Powered On

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
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 255 members 4,102 guests
Please welcome our newest community members: