cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
djworsdell
Frequent Visitor

Stuck with LookUp() - Cannot Reference a Dataverse lookup column?

Hello all,

 

I am running into a metaphorical brick wall regarding the LookUp() function with reference to lookup columns in Dataverse. There are two tables, 'tools' and 'actions', and I want to pick out the last action for that specific tool. A One-to-Many relationship has already been set up between 'tools' and 'actions'...

 

tools 
tool_idPrimary ID (Auto #)
rankingChoice
textText

 

actions 
action_idPrimary ID (Auto #)
toolLookup (tool_id)
statusChoice
 
Here's a snippet of the code I'm currently working with... Power Apps indicates that "LookUp has invalid arguments", but this is the format I've taken out of the documentation and have used with success in previous applications.
ClearCollect(data,
    AddColumns(
        // Get 'tools' table
        tools,
 
        // Identify last status from 'action'
        "status",
            LookUp(Sort(actions, createdon, Descending), cr979_toolsid = tool, status)
    )
);

Any ideas/suggestions would be greatly appreciated! If there's an alternative to LookUp() I'd also be very happy to hear them!

1 ACCEPTED SOLUTION

Accepted Solutions
Manan-Malhotra
Continued Contributor
Continued Contributor

Hey, Actually your lookup isn't reading the table name "action"
Try using "[@action]" this way

 

Please Accept as Solution if it solves your question Or just give it a Thumbs Up if it is helpful because this can help others.

LinkedIn: https://www.linkedin.com/in/manan-malhotra-vfx/

Want to support me! Buy me a Cup of Coffee?

View solution in original post

4 REPLIES 4
Manan-Malhotra
Continued Contributor
Continued Contributor

ClearCollect(data,
    AddColumns(
        // Get 'tools' table
        tools,
  
        // Identify last status from 'action'
        "status",
            LookUp(Sort(actions, createdon, Descending), cr979_toolsid = tool). status
    )
);

I am not sure why was "tool, status" used, were you trying to return status, if yes use the following code


@Manan-Malhotra wrote:

I am not sure why was "tool, status" used, were you trying to return status, if yes use the following code


Thanks Manan - now I've encountered an "AddColumns has some invalid arguments", and underlines the entire section red. Completly at a loss as I haven't seen this behaviour before...

Manan-Malhotra
Continued Contributor
Continued Contributor

Then I am guessing the code written by you is correct just change the new column name from "status" to "someother name"

Also can you share the Screenshot of the error if it still exists 

Manan-Malhotra
Continued Contributor
Continued Contributor

Hey, Actually your lookup isn't reading the table name "action"
Try using "[@action]" this way

 

Please Accept as Solution if it solves your question Or just give it a Thumbs Up if it is helpful because this can help others.

LinkedIn: https://www.linkedin.com/in/manan-malhotra-vfx/

Want to support me! Buy me a Cup of Coffee?

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,195)