web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : d1toSzz81S9WpvRybgNk33
Power Apps - Building Power Apps
Answered

patch function formula help needed

Like (0) ShareShare
ReportReport
Posted on 30 Oct 2019 20:39:58 by 60

I'm trying to have a bunch of text input boxes and drop downs update a spreadsheet. i need them to create a new row of information and then reset to blank on submission, seems simple enough but i keep getting errors and i really need someone to work through this with me.

 

 

Patch(Table1, Defaults(Table1), { DATE: DatePicker1.SelectedDate, NURSERY: Dropdown1.SelectedText, PLOT: TextInput1.Text, SUB_PLOT: TextInput2.Text, HISTORICAL_CROP_TYPE: Dropdown2.SelectedText, COMMENTS: TextInput3.Text, pH: TextInput4.Text, Ca: TextInput5.Text, Mg: TextInput6.Text, P: TextInput7.Text, K: TextInput8.Text, Cu: TextInput9.Text, Mn: TextInput10.Text, Zn: TextInput11.Text, B: TextInput12.Text}); Reset(DatePicker1); Reset(Dropdown1); Reset(TextInput1); Reset(TextInput2); Reset(Dropdown2); Reset(TextInput3); Reset(TextInput4); Reset(TextInput5); Reset(TextInput6); Reset(TextInput7); Reset(TextInput8); Reset(TextInput9); Reset(TextInput10); Reset(TextInput11); Reset(TextInput12); Navigate(SUBMIT_SUCCESS,ScreenTransition.None)

 

Error message:  the type of this argument 'HISTORICAL_CROP_TYPE' does not match the expected type 'text' . Found type 'Record'. 

 

thanks in advance!

 
 
 
 
 
 
Categories:
I have the same question (0)
  • Verified answer
    wyotim Profile Picture
    2,545 on 31 Oct 2019 at 15:18:22
    Re: patch function formula help needed

    @ronanf16, given that your dropdowns are hardcoded, I think @v-siky-msft's suggestion of

    HISTORICAL_CROP_TYPE: Dropdown2.Selected.Value

    should solve that issue. "Value" is the default property given to nameless lists (unless you use the Distinct function; then it uses "Result"). You will need to do the same for NURSERY, like so:

    NURSERY: Dropdown1.Selected.Value

     

    If both those columns are text in your spreadsheet, this should do the trick for writing those values. It is possible that there is another issue in your code, so if you could try those two changes and then maybe see what error is showing (if any) I'd be more than happy to follow up!

  • ronanf16 Profile Picture
    60 on 31 Oct 2019 at 15:04:55
    Re: patch function formula help needed

    NURSERY = Dropdown1 = ["BALLINTEPLE", "CLONE", "TINAHEALY" ]

    HISTORICAL_CROP_TYPE = Dropdown2 = ["CONIFOR", "BROADLEAF" ]

     

    I have changed things back to the original formula and original error message as I felt what I was changing wasn't solving the issues

  • wyotim Profile Picture
    2,545 on 31 Oct 2019 at 14:51:27
    Re: patch function formula help needed

    @ronanf16 Do you mind sharing what code you have in the dropdown's Items property? And also could you share what error code you are getting after trying those changes? That info would be helpful and appreciated in getting this thing sorted!

  • ronanf16 Profile Picture
    60 on 31 Oct 2019 at 14:42:14
    Re: patch function formula help needed

    thanks for the help guys but this still isn't working however. I have tried all your suggestions but to no avail.

     

    I guess HISTORICAL_CROP_TYPE is text in the datasource but my dropdowns do not pull from the datasource. the  options are simply pulled from the dropdown properties when they are entered between "". I don't know if this makes a difference.

     

     

     

     

     

  • v-siky-msft Profile Picture
    on 31 Oct 2019 at 08:53:18
    Re: patch function formula help needed

    Hi @ronanf16 ,

    What is the date type of HISTORICAL_CROP_TYPE field? And what is the Item property of that dropdown?

     

    The SelectedText property which is deprecated will return a record, however HISTORICAL_CROP_TYPE field is needed as a text.

    So you should add a "." behind the Dropdown2.SelectedText to select the fieldname, such as Dropdown2.SelectedText.Value, so that it will return the selected text.

    Note: The SelectedText is deprecated, you'd better to use Selected property. And the field name is up to the Items of drop down, It doesn't have to be the Value, please refer to the formula suggestion. The NURSERY should also be consided!

     

    Patch(Table1, Defaults(Table1), { DATE: DatePicker1.SelectedDate, NURSERY: Dropdown1.Selected, PLOT: TextInput1.Text, SUB_PLOT: TextInput2.Text, HISTORICAL_CROP_TYPE: Dropdown2.Selected.Value, COMMENTS: TextInput3.Text, pH: TextInput4.Text, Ca: TextInput5.Text, Mg: TextInput6.Text, P: TextInput7.Text, K: TextInput8.Text, Cu: TextInput9.Text, Mn: TextInput10.Text, Zn: TextInput11.Text, B: TextInput12.Text}); Reset(DatePicker1); Reset(Dropdown1); Reset(TextInput1); Reset(TextInput2); Reset(Dropdown2); Reset(TextInput3); Reset(TextInput4); Reset(TextInput5); Reset(TextInput6); Reset(TextInput7); Reset(TextInput8); Reset(TextInput9); Reset(TextInput10); Reset(TextInput11); Reset(TextInput12); Navigate(SUBMIT_SUCCESS,ScreenTransition.None)

     

     Hope this can help.

    Best regards,

    Sik

    If my post is helpful for you, please click on “Accept as Solution” to help other members find it more quickly.

     

  • wyotim Profile Picture
    2,545 on 30 Oct 2019 at 22:16:32
    Re: patch function formula help needed

    Hey @ronanf16, I would suspect the issue is coming from your use of SelectedText without identifying a field. This is likely causing it to use the entire record from the dropdown, not just the selected field that is displayed in the dropdown. Also, I think SelectedText is being depreciated, so you may want to use Selected instead. Maybe try: 

    // Assuming HISTORICAL_CROP_TYPE is the name of the field you are after
    HISTORICAL_CROP_TYPE: Dropdown2.Selected.HISTORICAL_CROP_TYPE


    You may need to do something similar for NURSERY as well as it is using the same format. 

     

    Let me know if that solves the issue or not; I'd be happy to follow up if needed!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading started