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:
Cheers
Solved! Go to Solution.
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"
Yet if If I change this to "User = ThisItem.'Created By'.User", the error goes away.
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'
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.
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.
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"
Yet if If I change this to "User = ThisItem.'Created By'.User", the error goes away.
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'
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.
User | Count |
---|---|
253 | |
122 | |
106 | |
54 | |
48 |