web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Unable to LOOKUP in DA...
Power Apps
Unanswered

Unable to LOOKUP in DATACARD

(0) ShareShare
ReportReport
Posted on by 383

Hi Power Apps Community,

I am trying to create an NewForm feature in Power Apps where one of the fields should be a lookup. I have tried the following, but have been unsuccessful:

LookUp(Collectionname, Field.Value = varCurrUser, ThisItem.Field)

Where varCurrUser = First(Split(Office365Users.MyProfile().UserPrincipalName, "@" )).Result

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
 Value: LookUp(CollectionName, Field.Value = varCurrUser, ThisItem.Field)}

Note: The data is being stored in a Collection.

I would really appreciate any assistance.

Thank you in advance.

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Data_Enthusiast 

    Can you explain more about what the actual issue is you're seeing?

    I can see that your formula:

    LookUp(Collectionname, Field.Value = varCurrUser, ThisItem.Field)

    Is not going to work as you are trying to reference the column you want to return as a variable name (ThisItem.Field).  You would need to specify the column in the third parameter.

  • Data_Enthusiast Profile Picture
    383 on at

    @RandyHayes 

    I should have mentioned... I am receiving an error message: "Expected Text value" for the formula that you have highlighted. 

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Data_Enthusiast 

    I'm sorry, I'm just not understanding your scenario.  

    You have supplied two formulas - but where are these formulas being used (control and action)?  What is their purpose?  What is it that you are trying to do?  You only mention that you are trying to create a "NewForm feature".  I'm not sure what that means as the EditForms in PowerApps already have a new form capability. 

    You mentioned that "one of the fields should be a lookup".  Does this mean that you want to lookup a value for a field, or that the field is a Lookup column in SharePoint?

    Finally, you mention a collection...where does that come in to play in any of this?

     

    Please provide more detail - it will greatly increase the chance of a good solution for you.

  • Data_Enthusiast Profile Picture
    383 on at

    @RandyHayes 

    Happy to give more context.

    The two formulas provided are what I have tried - trying different options, but not knowing if one was more correct than the other -> these formulas were added individually to the 'Items' property of the Data Card.

    NewForm in the sense that I am trying to add data to a SP List, and not edit existing data - which is what EditForm is (an explanation I got of what the two are).

    With regards to the lookup field, it is a lookup field in SharePoint (which has the user name). I would like for the data card in Power Apps to be pre-populated with the user name of the current logged in user - currently, it is providing a list of all the users.

    For the Collection, I am storing the data in a Collection to avoid delegation issues. I read on the community forum that Collections do not have delegation issues - I have not had any issue with this, hence why the data is in a Collection. As a result, the data source for my Form reference the Collection. 

    This initial process made sense to me, but I am more than happy to receive advise on how to better the process of what I am trying to achieve.

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Data_Enthusiast 

    So first off, EditForms are also NewForms.  In fact a form has three different modes - View, Edit, New  There is no need to recreate the logic.

     

    The next bit is that you say you are trying to base your EditForm on a collection.  This is not possible for a Form.  It needs to be a viable datasource.  It will have no delegation issues as it is just a form.

     

    The factor of having the current user selected in the control on your form is vastly different than the above.  So, let's resolve the above first.  

    Please verify that you are using an EditForm or if you are attempting custom controls to simulate your form.

     

    If you are using an EditForm, then tell me more about the column that holds the user name.  You say this is a Lookup column in SharePoint.  What is the list that it refers to and what is the value that it stores in your primary list?

     

  • Data_Enthusiast Profile Picture
    383 on at

    @RandyHayes 

    Thank you for the clarity.

    I went back and selected the EditForm option.

    I have a 'Products' table which has a lookup field called User Name. User Name comes from my main People list - set up provided below where 'EID' is the user name.

    Data_Enthusiast_0-1602602148257.png

    Then there are two fields in the Products list which the user may interact with.

    Hope this helps.

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Data_Enthusiast 

    Okay, very good.  So, the reality is that if you have this lookup column in your EditForm, PowerApps will already have the "mechanism" in place to get the information from the looked up list and then store the correct information when submitted.

     

    Are you not seeing that ability, or where are you at this point?

  • Data_Enthusiast Profile Picture
    383 on at

    Hi @RandyHayes 

    I can see that ability. I have brought in the lookup field on the form, but it is currently listing all the users. This enables me to submit data against some else's name - which is not what I would like to have. I would need a formula to have the default value of the data card as the user name of the person signed in.

    I am wondering though if I should create labels and text inputs and Patch the data entered to SP?

  • Verified answer
    Data_Enthusiast Profile Picture
    383 on at

    @RandyHayes 

    I managed to solve my issue:

    Filter(Choices(List.Field), Value = (LookUp(List.Field, Field.Value = var, Field.Value)))

    This hard locks the value required in the data card.

    Thank you for providing clarity along the way. Got me thinking about what I was doing 😀 

  • Community Power Platform Member Profile Picture
    on at

    This actually still doesn't work, probably the solution does, still sucks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard