cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Invalid Argument Type using the LookUp function with 2 Sharepoint Lists

I'm having an issue with the below formula that is telling me the Project={} portion of the code is an "Invalid argument type." From my limited PA experience, I have learned that this usually means I need to cast the data, or use data qualifiers, in order to make the argument perform as desired.  However, I cannot seem to figure this one out.

Here is an explanation of my data setup:
'Cross Charges'
list has Title (text), Actively Charging St (choice), and Project (LookUp of 'Project List' SP List).

Here is the code that is failing at the = sign of the Project={}:

If(
    IsBlank(
        LookUp(
            'Cross Charges',
            And(
                Title=Text(Office365Users.MyProfileV2().displayName),
                Actively_x0020_Charging_x0020_St.Value="Active",
                Project={
                    '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                    Id: LookUp('Project List', Title=AllProjects.Selected.ID)
                    }
            )
        )
    ),
    DisplayMode.Edit,
    DisplayMode.Disabled
)


I have tried switching it up to:

Project.Value={}
Project=Value({})
Project.Id={}

...all to no avail. 

If anyone has any ideas, I would greatly appreciate it, as I am stumped! And am probably overthinking the problem.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Hi @Anonymous ,

Which column of your 'Project List' SP List do you reference to from the Project column in your 'Cross Charges' list? Is it the Title column?

 

I assume that the Project LookUp type column reference the values from the Title column in your 'Project List' SP List, is it true? Based on the formula that you mentioned, I think there is something wrong with it.

 

I have made a test on my side, please consider take a try with the following formula:

If(
    IsBlank(
        LookUp(
            'Cross Charges',
             And(
                Title=Text(Office365Users.MyProfileV2().displayName),
                Actively_x0020_Charging_x0020_St.Value="Active",
                Project.Value = LookUp('Project List', ID = AllProjects.Selected.ID, Title) // Modify formula here
            )
        )
    ),
    DisplayMode.Edit,
    DisplayMode.Disabled
)

 

Please consider take a try with the following workaround, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Highlighted
Super User II
Super User II

@Anonymous 

Your LookUp appears to be returning a full record, try adding the attribute definition, like

 

LookUp('Project List', Title=AllProjects.Selected.ID, Title)

OR

LookUp('Project List', Title=AllProjects.Selected.ID).Title

 

I would also add 

Project.Value = {...

when testing the above

 

Hovering over the error will sometimes give you the info you need here. Intellisense may tell you "Invalid argument type" : "Expecting data type text: received data type table", or words to that effect, which can be helpful with complex queries.

Highlighted
Anonymous
Not applicable

Oy, thank you so much for your time, but these options just return the same error (invalid argument type). I wish Intellisense would tell me more, but no such luck. I'm definitely stumped.

Highlighted

Well I think I'm stumped now as well! To me, it seems like the invalid argument is related to try to compare a value (intersection of a row+column) with either a FULL record or a table?

 

I guess you could try wrapping your {...} code in First() or LookUp(), treating it as a table/record, then setting the attribute you want? You could also try {...}.Value - pretty sure this won't work but it may?

 

I sometimes place parts of my code inside a label to see what I'm getting back is what I think I'm supposed to get returned. Maybe you could also try this with the {...} code snippet?

Highlighted

Hi @Anonymous ,

Firstly @Eelman has you on the right track.

I have fought with these SharePoint lookup field in the past and have got rid of them . . But that does not help you. My 20c worth of suggestion is to try

If(
   IsBlank(
      LookUp(
         'Cross Charges',
         Title=Text(Office365Users.MyProfileV2().displayName) &&
         Actively_x0020_Charging_x0020_St.Value="Active" &&
         Project=
         LookUp(
            'Project List', 
             Title=AllProjects.Selected.Value
         )
      )
   ),
   DisplayMode.Edit,
   DisplayMode.Disabled
)

 In a search, you should be able to reference the field text component by its element .Value.

Highlighted
Community Support
Community Support

Hi @Anonymous ,

Which column of your 'Project List' SP List do you reference to from the Project column in your 'Cross Charges' list? Is it the Title column?

 

I assume that the Project LookUp type column reference the values from the Title column in your 'Project List' SP List, is it true? Based on the formula that you mentioned, I think there is something wrong with it.

 

I have made a test on my side, please consider take a try with the following formula:

If(
    IsBlank(
        LookUp(
            'Cross Charges',
             And(
                Title=Text(Office365Users.MyProfileV2().displayName),
                Actively_x0020_Charging_x0020_St.Value="Active",
                Project.Value = LookUp('Project List', ID = AllProjects.Selected.ID, Title) // Modify formula here
            )
        )
    ),
    DisplayMode.Edit,
    DisplayMode.Disabled
)

 

Please consider take a try with the following workaround, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted

Hi @Anonymous ,

Thanks @v-xida-msft for picking up my typing omission.

I believe this with the amendment will address your issue.

 

 

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.

Highlighted
Anonymous
Not applicable

Thank you everyone for your help!

@WarrenBelz  & @v-xida-msft - the combination of your solutions solved the problem, thank you so much!

Sometimes the LookUps of SP LookUp fields, and data types returned can be a little confusing. Thanks again!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,343)