cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mrQ
Helper V
Helper V

The right side of the equal needs to be a constant value?

Dear all

 

I have a CDS table with a LookUp to the Users table.

 

In a gallery, I would like to get a field from the Users table with LookUp(), but with the following formula I get the error message in the subject/below. Does anyone know why? I've used LookUp a million times before (although not with CDS), and I never run into this before.

LookUp(Users, User = ThisItem.'Created By'.User).'Full Name'

Error:

error-users.png

 

Cheers

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
timl
Super User
Super User

Hi @mrQ 

I've seen errors of this nature before, often when I call look up from within a ForAll.

I've put this down to a bug, or a glitch in the designer.

In most cases, I find that I can remove the error by reversing the values in the condition (which I guess is what error message alludes to).

For example, here's where I've recreated the error by adding the condition "ThisItem.'Created By'.User = User"

timl_0-1609159466538.png

Yet if If I change this to "User = ThisItem.'Created By'.User", the error goes away.

timl_1-1609159580505.png

 

Another tip I would add is that with CDS/Dataverse, it's possible to retrieve user details without calling LookUp. In your gallery control, you can just use this syntax:

ThisItem.'Created By'.'Full Name'

 

View solution in original post

FabianAckeret
Solution Sage
Solution Sage

Hi @mrQ 
In addition to @timl 's response:

 

I also often encountered it in a ForAll loop. While I didn't know that you could simply switch the conditions, I used As as a workaround.

For example:

ForAll(
    <datasource> As MyCustomName,
    LookUp(Users, User = MyCustomName.'Created By'.User).'Full Name'
)

 

Instead of ThisRecord, you'd simply use MyCustomName

 

I hope this helps.


Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @mrQ ,

I am a SharePoint user, but this may work for you - assuming User in your Users table is a single line of text

LookUp(
   Users, 
   User = ThisItem.'Created By'.DisplayName
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz 

I'm also a SharePoint user and recently tried my luck with CDS/Dataverse, but I find it strange in many ways. 

 

In CDS, you have a default Users table. I realized the table is being filled automatically with all users in the tenant, including a column called User that is the unique identifier for a particular user in that table. All this is managed automatically by M365. 

I have also added a custom column to the Users table - Billable Rate (I know, in my initial post I mentioned 'Full Name', but I didn't wanted to confuse you guys, cause getting a certain value from that table works the same way, whether it is 'Full Name' or 'Billable Rate').

 

In the mentioned gallery from my initial post, for the Items property, I'm using a custom-table from CDS (let's call it 'Time Tracking' ). Now, for some reason I get the error message when I'm trying to get the 'Billable Rate'. However, even though I'm getting the error message, it still shows up correctly in the gallery.

Hi @mrQ ,

What exactly are you trying to compare in this table to get the output? I assumed you were after a match on the user that created the record.

timl
Super User
Super User

Hi @mrQ 

I've seen errors of this nature before, often when I call look up from within a ForAll.

I've put this down to a bug, or a glitch in the designer.

In most cases, I find that I can remove the error by reversing the values in the condition (which I guess is what error message alludes to).

For example, here's where I've recreated the error by adding the condition "ThisItem.'Created By'.User = User"

timl_0-1609159466538.png

Yet if If I change this to "User = ThisItem.'Created By'.User", the error goes away.

timl_1-1609159580505.png

 

Another tip I would add is that with CDS/Dataverse, it's possible to retrieve user details without calling LookUp. In your gallery control, you can just use this syntax:

ThisItem.'Created By'.'Full Name'

 

FabianAckeret
Solution Sage
Solution Sage

Hi @mrQ 
In addition to @timl 's response:

 

I also often encountered it in a ForAll loop. While I didn't know that you could simply switch the conditions, I used As as a workaround.

For example:

ForAll(
    <datasource> As MyCustomName,
    LookUp(Users, User = MyCustomName.'Created By'.User).'Full Name'
)

 

Instead of ThisRecord, you'd simply use MyCustomName

 

I hope this helps.


Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,728)