cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
samanthafinnie
Level: Powered On

Invalid Number of Arguments

I am trying to run a flow from a button in power apps. Everytime I do it I get the same error and I have tried changing multiple things in the formula and also in the flow.  I dont know what I need to do have it so it works. It wont run the flow when I push the button.  

* I have also tried so I only had 1 "send email in body/ Ask power apps" in Microsoft Flow

 

I have attached some screenshots for reference. 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Invalid Number of Arguments

I'm pretty sure the value you need is DataCardValue4.Selected.Value based on what I see in the screenshot.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
11 REPLIES 11
samanthafinnie
Level: Powered On

Re: Invalid Number of Arguments

Some things I have tried. 

Highlighted
Super User
Super User

Re: Invalid Number of Arguments

Replace the '&' ampersands in your run statements with ',' commas.  The Ampersands concatentate all the values into one long string while the Flow is expecting to receive 4 string parameters.  Your run statement should taek this form.

 

TestPowerAppButton.run(String1, string2, string3, string4)

 

yours looks like this

 

TestPowerAppButton.run(String1 & string2 & string3 & string4)

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
samanthafinnie
Level: Powered On

Re: Invalid Number of Arguments

hello @Pstork1 ,

Thank you for your fast reply. 

I have tried the following options and it gave me  2 errors:

Option 1- testPowerAppButton.Run(Name_DataCard1, Email_DataCard1, DES_DataCard1, Supplier_DataCard1)

Option 2- testPowerAppButton.Run(BrowseGallery1.Selected.Name, BrowseGallery1.Selected.Email, BrowseGallery1.Selected.DES, BrowseGallery1.Selected.Supplier)

 

Option 1- Gave me tons of errors!

Option 2- Errors: Invalid Argument Type (record), expecting text value instead.

*All of these options are text options

Error 2-The function 'run' has some invalid arguments

Super User
Super User

Re: Invalid Number of Arguments

Option #1 is close, but you can't pass the entire card as a parameter.  You ahve to pass the text value contained in the card.  So its something like this:

testPowerAppButton.Run(DataCardValue4, DataCardValue8, DataCardValue12, DataCardValue16)

You'll need to expand each datacard to find out what the name of the Value inside the datacard is.

 

Option#2 would probably work also, but one of the values you are referencing is a collection of records and not a Text value.  Its probable either DES or Supplier if either of these is implemented as a Dropdown.  Putting a First() around a set of records will return the first record and that will often help.

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
samanthafinnie
Level: Powered On

Re: Invalid Number of Arguments

Hello @Pstork1 , 

Thank you so much that worked by doing it this way. I have been trying to figure out how I was going to do this via Microsoft for weeks and this solved helped solve it!!! So excited!

This is what i used: 

 

testPowerAppButton.Run(DataCardValue1,DataCardValue2,DataCardValue5, DataCardValue7)

 

and then I did ,so I could test a value that was a number and that worked. 

 

testPowerAppButton.Run(DataCardValue1,DataCardValue2,DataCardValue5, (DataCardValue3)) 

For example (supplier = airline= data card 4)

 

When I tried doing it  for a value that is a drop-down menu it didnt work...

 

testPowerAppButton.Run(DataCardValue1,DataCardValue2,DataCardValue5,(DataCardValue4)) 

 

I want to keep those options as a drop-down menu since it helps  better if I keep it hooked up to Power Bi. 

Thank you so much for your help so far-- once this last piece is solved then I will close this form and I will have everything perfect! 

Super User
Super User

Re: Invalid Number of Arguments

For the dropdowns make sure you add .value to the selected property.  You need that to get just the text rather than the text and the index.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
samanthafinnie
Level: Powered On

Re: Invalid Number of Arguments

Sorry I tried the following:

 

testPowerAppButton.Run(DataCardValue1,DataCardValue2,DataCardValue5,(DataCardValue4.value)) 

and 

testPowerAppButton.Run(DataCardValue1,DataCardValue2,DataCardValue5,(DataCard.value4))

 and

testPowerAppButton.Run(DataCardValue1,DataCardValue2,DataCardValue5,DataCard.value4)

and 

testPowerAppButton.Run(DataCardValue1,DataCardValue2,DataCardValue5,DataCardValue4.value)

and 

testPowerAppButton.Run(DataCardValue1,DataCardValue2,DataCardValue5,DataCard.value4)

 

Sorry this is my first time using power apps so I don't have the formulas down yet! Are you able to give me an example of it?

Super User
Super User

Re: Invalid Number of Arguments

Which of the datacards contain Dropdowns and what is the name of the dropdown control?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
samanthafinnie
Level: Powered On

Re: Invalid Number of Arguments

Hello @Pstork1 

DataCard 4 contains a drop down menu-- i have attached some pictures that may help figure that out. 

 

Sorry I dont know what you mean the name of the dropdown control...

 

Also if you are wondering where I get this information from it from Microsoft forms to a SharePoint then to power app... dropdown3.pngdropdown2.pngdropdown1.png