cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Zgolbarg
Helper III
Helper III

Submit button

I have two SharePoint lists: project request and project type. There is a lookup column in project request(name:project type) for project type that link to project type list ( name is title)

 

I have a dropdown in app that link to project type list. I used patch to send data via submit button to project request list.

This is the formula:

 

Patch(
'Project Request',
Defaults(Project Request),
{

 'project type': drpProjectType.selected
}

 

but I have this error:

Invalid argument type.

 

Can you help me with that?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @RandyHayes 

it is a single lookup

and picture shows the correct answer

I checked the list and it was added 

 

You are really kind and Thanks for taking the time to solve my problem.

 

View solution in original post

15 REPLIES 15
RandyHayes
Super User
Super User

@Zgolbarg 

What is the Items property of your drpProjectType control?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi Randy,

 

This dropdown is connected to the project type list and the Item is the name of the list.

 

I have another dropdown with the same scenario and the Item property of that dropdown has Filter inside it.

RandyHayes
Super User
Super User

@Zgolbarg 

Then if you are trying to create a new record, use the following:

Patch('Project Request',
    Defaults(Project Request),
    {
        'project type': {Value: drpProjectType.Selected.Title, Id: drpProjecttype.Selected.ID}
    }
)

Also can be done with:

Collect('Project Request',
    {
        'project type': {Value: drpProjectType.Selected.Title, Id: drpProjecttype.Selected.ID}
    }
)

Couple of things:

1) Make sure you are supplying any required column values.

2) When you set a Lookup column in your list, you need to provide a record (assuming it is single selection column and not multiple).  That record needs to have two columns, a Value column that is the linked value from the other list (default is Title, but verify in your SharePoint list lookup column definition) and you need to provide the ID of the record in the other list in the column Id. (Please note the difference in letter case...a record has an ID, a lookup column has a record that has an Id column)

 

You can also have the dropdown do the work for you...if the items property is the following:

ForAll(yourDataList,
    {Value: Title,
     Id: ID
    }
)

Or even if a filtered list:

ForAll(Filter(yourDataList, <somecriteria>),
    {Value: Title,
     Id: ID
    }
)

Then your original formula would work!

Patch('Project Request',
    Defaults(Project Request),
    {
        'project type': drpProjectType.Selected
    }
)

This is because you defined your Items of the dropdown to be a table with records with two columns...a Value column and an Id column - which is what the field wants in order to be updated.  So, Selected will be that exact record schema.

 

Always a lot of ways to go about something, just depends on what fits the need best.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi,

I tried your first formula and assigned ID and Value but it didn't work. I changed the Item formula to Choices from the project request list and used the original formula and worked. 

 

With the filter I have this formula:

Sort(Filter(Clients, Status.Value = "Active").Title,Title,Ascending)

I added ForAll function but gave me a syntax error. Can you tell me how to add it?

 

Thank you for your help

 

RandyHayes
Super User
Super User

@Zgolbarg 

Choices will work because Choices is smart enough to know that when you do choices on a LookUp column, it will produce a table with records that have a Value and an Id in them automatically for you.  Sometimes it is not desirable to use Choices and so the other formulas I provided would be better for those scenarios.

 

Tell me more about this formula you are talking about...is this one of the Items properties for a Lookup column dropdown?  If so, you will not be able to use that formula that way as you are restricting it to a single column table with records that only have a Title column...you WILL need the ID column in order to use it.

 

So, if I am guessing what you might be talking about, then your formula should be:

ForAll(
    Sort(Filter(Clients, Status.Value = "Active"), Title),
    {Value: Title,
     Id: ID
    }
)
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thanks a lot, with your formula I understand the meaning. 

Appreciate that

 

Just want to check with you  this Filter when using ForAll:

 

Filter(Contacts, Trim(drpClients.SelectedText.Value) in Company.Value).'Full Name'

 

ForAll(

         Filter(Contacts, Trim(drpClients.SelectedText.Value) in Company.Value)

         {value: Full Name,

          Id: ID

          }

)

 

RandyHayes
Super User
Super User

@Zgolbarg 

Everything is working as expected now?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Just want to check with you another Filter  when using ForAll:

 

Filter(Contacts, Trim(drpClients.SelectedText.Value) in Company.Value).'Full Name'

 

ForAll(

         Filter(Contacts, Trim(drpClients.SelectedText.Value) in Company.Value)

         {value: Full Name,

          Id: ID

          }

)

 This one give me invalid argument error

same for this filter as well:

 

Filter(Contacts, (Trim(drpClients.SelectedText.Value) in Company.Value) And (Bill_To.Value = "Yes")).'Full Name'

 

Sorry for the Inconvenience

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,791)