cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Viral21
Helper IV
Helper IV

lookup column issue in powerapps

Hello all,

I have used sharepoint list Lookup column in my app
And on save button I got this error
Can anyone help for that?

Viral21_0-1615432950369.png

Share point list name: ListItems2

Viral21_1-1614928154679.png

1 ACCEPTED SOLUTION

Accepted Solutions

Hi@Viral21,

Have seen how the template created the variable, there is no need to change it, just keep it as before.

The LookUp column has its certain format that you should find its Id and value from the original SP list. So we should use the LookUp() to find the corresponding Id and value.

The variable SelectedReort2 is a record, so there is something syntax you should modify.

Please try the formula as below, replace your SelectedReort2.ID with the following formula:

{
            Id: LookUp(
                MeType,
            MType = SelectedReort2.RecordID.Value
            ).ID,
            Value: SelectedReort2.RecordID.Value
        }

Notice that the SP list 'MeType' is the list where the lookup column ReportID retrieves values from and the MType column is a Text column where stores the ReportID values.

Hope it could help.

Regards,

Qi

Best Regards,
Qi

View solution in original post

10 REPLIES 10
Amol-Kavnekar
Helper I
Helper I

HI @Viral21 ,

 

 It is because RecordID Requires the Record but you are passing the Numeric value in it.

Kindly pass the record as shown in below blog.

PowerApps Tip: Setting a SharePoint List Lookup Column | Marc D Anderson's Blog (sympmarc.com)

 

 

Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

v-qiaqi-msft
Community Support
Community Support

Hi@Viral21,

Do you want to patch to a LookUp column in your SP list?

Could you please tell me that how you set the variable SelectedReport, post your Set or UpdateContex formula?

Actually, LookUp column has a special format as below:

{Lookup:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                        Id:SelectedReport2.ID,
                        Value:SelectedReport2}
              }

I have a test on my side, please take a try as below.

There is a Combo Box(DataCardValue9) in my scenario to select report ID, here I show you how I create the variable SelectedReport2:

Set(SelectedReort2,DataCardValue9.Selected.Value)

So please replace your SelectedReort2.ID with the following formula:

{
        RecordID: {
            Id: LookUp(
                MeType,
                MType = SelectedReort2
            ).ID,
            Value: SelectedReort2
        }
    }

Notice that the SP list 'MeType' is the list where the lookup column ReportID retrieves values from and the MType column is a Text column where stores the ReportID values.

Hope it could help.

Regards,

Qi

Best Regards,
Qi

Hello @v-qiaqi-msft 
I have attached my app package here
Can you please let me know where I need to do change?

Hi@Viral21,

I am so sorry that it is not allowed for us to access to your data and I recommend that you delete your app ASAP.

Genre SP list has a LookUp column named RecordID that retrieve values from 'MType' column in another SP list MeType.

2021-03-11-01.png2021-03-11-02.png

I can tell you that in my scenario, there is a Combo Box(DataCardValue9) I used to pupulate with the LookUp column, I set the Items property as below:

Choices([@Genre].RecordID)

I suggest that you could remove the variable SelectedReport2 firstly and replace it with the original format as below

DataCardValue9.Selected.Value

So you could write your formula as below:

{
        RecordID: {
            Id: LookUp(
                MeType,
                MType = DataCardValue9.Selected.Value
            ).ID,
            Value: DataCardValue9.Selected.Value
        }
    }

Note: Restore your variable to the original formula.

Please check if it works.

Regards,

Qi

 

Best Regards,
Qi

HI @v-qiaqi-msft 
How can I remove  variable SelectedReport2 ?
Can you please let me know steps?

Hi@Viral21,

Just go to where you set the variable SelectedReport2 and clear the whole Set(0 or UpdateContext().

2021-03-11-03.png

Qi

Best Regards,
Qi

Hello @v-qiaqi-msft 

I am using Expense Report power app template.

 

Into that in variable I can se SelectedReport2

But I not able to found on which button it's created.

 

Is there any way to find that?

 

Hi@Viral21,

You can go to File tab and click the Variable, find the SelectedReport2 and you can capture its location as below:2021-03-12-01.png

Then you could identify how it creates the SelectedReport2, if it is created based on the dropdown selected, you could check the first solution I provided.

Hope it could help.

Regards,

Qi

Best Regards,
Qi

Hello @v-qiaqi-msft 
It's set on Gallery property -> onselect

Viral21_0-1615562957156.png

on that gallery Item property have below mention value

Viral21_1-1615563001371.png

so can you guide me , now what I need to do for that?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Users online (2,474)